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

Function benchmark_burst

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

Source from the content-addressed store, hash-verified

222
223
224def benchmark_burst(StreamReader, packets, size, count):
225 reader = StreamReader()
226 for _ in range(count):
227 for packet in packets:
228 reader.feed_data(packet)
229 reader.feed_eof()
230 for _ in range(count):
231 yield from reader.readexactly(2)
232 if size >= 65536:
233 yield from reader.readexactly(4)
234 elif size >= 126:
235 yield from reader.readexactly(2)
236 yield from reader.readexactly(size)
237 assert reader.at_eof()
238
239
240def run_benchmark(size, count, packet_size=None, number=1000):

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…