Skip to content

Disable compression in the asyncio_websockets benchmark - #526

Merged
StanFromIreland merged 3 commits into
python:mainfrom
StanFromIreland:cmpression
Nov 28, 2026
Merged

StanFromIreland merged 3 commits into
python:mainfrom
StanFromIreland:cmpression

Conversation

@StanFromIreland

Copy link
Copy Markdown
Member

Fixes #460.

@diegorusso

Copy link
Copy Markdown
Contributor

Without compression, what's the profile of the benchmark?

@StanFromIreland

Copy link
Copy Markdown
Member Author

Before:

         482162 function calls (469516 primitive calls) in 3.285 seconds

   Ordered by: internal time
   List reduced from 2377 to 12 due to restriction <12>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     2000    2.061    0.001    2.061    0.001 {method 'compress' of 'zlib.Compress' objects}
     2000    0.780    0.000    0.780    0.000 {method 'decompress' of 'zlib.Decompress' objects}
      140    0.113    0.001    0.916    0.007 protocol.py:564(parse)
     2120    0.022    0.000    0.022    0.000 {method 'send' of '_socket.socket' objects}
      166    0.014    0.000    0.014    0.000 {built-in method marshal.loads}
     2000    0.012    0.000    0.012    0.000 {method 'flush' of 'zlib.Compress' objects}
      167    0.010    0.000    0.010    0.000 {method 'read' of '_io.BufferedReader' objects}
     2040    0.008    0.000    0.801    0.000 frames.py:260(parse)
       40    0.006    0.000    0.011    0.000 run_benchmark.py:20(handler)
     2040    0.006    0.000    2.081    0.001 permessage_deflate.py:170(encode)
     2040    0.006    0.000    2.092    0.001 frames.py:334(serialize)
     2000    0.005    0.000    2.142    0.001 connection.py:403(send)

After:

         847568 function calls (821904 primitive calls) in 2.052 seconds

   Ordered by: internal time
   List reduced from 2361 to 12 due to restriction <12>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     6100    0.738    0.000    0.738    0.000 {method 'write' of '_io.BytesIO' objects}
     8223    0.311    0.000    0.311    0.000 {method 'recv' of '_socket.socket' objects}
     1115    0.183    0.000    0.183    0.000 {method 'sendmsg' of '_socket.socket' objects}
     1115    0.130    0.000    0.351    0.000 selector_events.py:1095(_write_sendmsg)
     8103    0.104    0.000    0.104    0.000 streams.py:131(feed_data)
     4040    0.091    0.000    0.091    0.000 {built-in method websocket.speedups.apply_mask}
    16123    0.070    0.000    0.071    0.000 streams.py:62(read_exact)
     1115    0.029    0.000    0.030    0.000 selector_events.py:1125(_adjust_leftover_buffer)
     8627    0.023    0.000    1.956    0.000 base_events.py:1984(_run_once)
    10063    0.013    0.000    0.127    0.000 frames.py:260(parse)
      166    0.012    0.000    0.012    0.000 {built-in method marshal.loads}
     8627    0.012    0.000    0.012    0.000 {method 'poll' of 'select.epoll' objects}

@StanFromIreland
StanFromIreland merged commit b5d84d8 into python:main Nov 28, 2026
21 checks passed
@StanFromIreland
StanFromIreland deleted the cmpression branch November 28, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

asyncio_websockets tests the implementation of zlib, not of Python

3 participants