MCPcopy Index your code
hub / github.com/python-websockets/websockets / benchmark_stream

Function benchmark_stream

experiments/optimization/streams.py:209–221  ·  view source on GitHub ↗
(StreamReader, packets, size, count)

Source from the content-addressed store, hash-verified

207
208
209def benchmark_stream(StreamReader, packets, size, count):
210 reader = StreamReader()
211 for _ in range(count):
212 for packet in packets:
213 reader.feed_data(packet)
214 yield from reader.readexactly(2)
215 if size >= 65536:
216 yield from reader.readexactly(4)
217 elif size >= 126:
218 yield from reader.readexactly(2)
219 yield from reader.readexactly(size)
220 reader.feed_eof()
221 assert reader.at_eof()
222
223
224def benchmark_burst(StreamReader, packets, size, count):

Callers

nothing calls this directly

Calls 5

feed_dataMethod · 0.95
feed_eofMethod · 0.95
at_eofMethod · 0.95
StreamReaderClass · 0.85
readexactlyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…