Skip to content

Use VibeIO as runtime#64

Open
egorsmkv wants to merge 21 commits into
masterfrom
compio-vs-vibeio
Open

Use VibeIO as runtime#64
egorsmkv wants to merge 21 commits into
masterfrom
compio-vs-vibeio

Conversation

@egorsmkv

@egorsmkv egorsmkv commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

This PR exists because currently rsloop has two runtimes: compio for macOS/Linux and vibeio for Windows.

I would like to simplify it and leave only vibeio because it has support for all platforms.

Also, this PR introduces enhancements optimizations in different parts.

@egorsmkv

Copy link
Copy Markdown
Contributor Author
uv run --with uvloop python benchmarks/compare_event_loops.py
Uninstalled 1 package in 0.82ms
Installed 1 package in 2ms
Running callbacks on asyncio...
Running callbacks on uvloop...
Running callbacks on rsloop...

callbacks (200,000 ops)
loop           median_s       best_s      ops_per_s   baseline_rss     peak_rss   peak_delta   vs_fastest
rsloop         0.075303     0.075215      2,655,935       21.7 MiB     58.8 MiB     37.1 MiB        1.00x
uvloop         0.082945     0.082326      2,411,226       21.4 MiB     64.2 MiB     42.8 MiB        1.10x
asyncio        0.338389     0.332974        591,036       20.1 MiB     52.6 MiB     32.5 MiB        4.49x
Running tasks on asyncio...
Running tasks on uvloop...
Running tasks on rsloop...

tasks (50,000 ops)
loop           median_s       best_s      ops_per_s   baseline_rss     peak_rss   peak_delta   vs_fastest
uvloop         0.241977     0.238428        206,631       21.5 MiB     35.6 MiB     14.1 MiB        1.00x
rsloop         0.258462     0.256458        193,452       21.6 MiB     35.9 MiB     14.3 MiB        1.07x
asyncio        0.481468     0.476917        103,849       20.1 MiB     33.0 MiB     12.9 MiB        1.99x
tcp_streams mode: rsloop native fast streams
Running tcp_streams on asyncio...
Running tcp_streams on uvloop...
Running tcp_streams on rsloop...

tcp_streams (5,000 ops)
loop           median_s       best_s      ops_per_s   baseline_rss     peak_rss   peak_delta   vs_fastest
rsloop         0.129433     0.122135         38,630       21.7 MiB     24.1 MiB      2.3 MiB        1.00x
uvloop         0.243085     0.238799         20,569       21.5 MiB     22.7 MiB      1.2 MiB        1.88x
asyncio        0.625537     0.605917          7,993       20.1 MiB     20.3 MiB    172.0 KiB        4.83x

@egorsmkv

Copy link
Copy Markdown
Contributor Author
uv run --with uvloop python benchmarks/workload_matrix.py   --loops rsloop,uvloop   
Running http_keepalive on rsloop...
Running http_keepalive on uvloop...

http_keepalive
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.0340       23,544         25,180       95.8      0.607      0.645      1.170     24.4 MiB    0.0014     0.0318    0.0008   0.0000
rsloop         0.0386       20,715         28,194       84.3      0.547      0.637      0.846     26.3 MiB    0.0094     0.0278    0.0008   0.0000
Running tls_http on rsloop...
Running tls_http on uvloop...

tls_http
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.0948        8,436         13,292       34.3      1.149      1.277      2.628     26.8 MiB    0.0325     0.0602    0.0021   0.0000
rsloop         0.2280        3,509         23,691       14.3      0.651      0.736      0.823     40.2 MiB    0.1930     0.0335    0.0012   0.0000
Running websocket_messages on rsloop...
Running websocket_messages on uvloop...

websocket_messages
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.3068        2,607          2,637        7.3      6.139      7.120      7.185     24.5 MiB    0.0027     0.3034    0.0008   0.0000
rsloop         0.3178        2,517          2,602        7.0      6.006      9.251     10.171     26.6 MiB    0.0096     0.3064    0.0009   0.0000
Running mixed_streams on rsloop...
Running mixed_streams on uvloop...

mixed_streams
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.0473       16,917         17,717      669.6      0.841      1.071      1.883     26.3 MiB    0.0014     0.0452    0.0007   0.0000
rsloop         0.0529       15,122         22,223      598.6      0.694      0.756      1.295     28.4 MiB    0.0160     0.0360    0.0008   0.0000
Running bulk_transfer on rsloop...
Running bulk_transfer on uvloop...

bulk_transfer
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0415          385            583      770.9     24.136     26.869     26.869     58.5 MiB    0.0135     0.0275    0.0006   0.0000
uvloop         0.0469          341            356      682.6     35.457     44.819     44.819     47.3 MiB    0.0014     0.0450    0.0005   0.0000
Running idle_connections on rsloop...
Running idle_connections on uvloop...

idle_connections
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.0603        3,315         23,237        0.0      6.304      6.674      6.914     26.2 MiB    0.0417     0.0089    0.0101   0.2006
rsloop         0.1013        1,975         20,638        0.0      5.951      7.572      7.739     30.9 MiB    0.0757     0.0154    0.0179   0.2002

@egorsmkv

Copy link
Copy Markdown
Contributor Author
devops@ml-lab2:~/Work/RustedBytes/rsloop$ uv run python -V
Python 3.14.0
devops@ml-lab2:~/Work/RustedBytes/rsloop$ uv run --with uvloop python benchmarks/workload_matrix.py   --loops rsloop,uvloop
Running http_keepalive on rsloop...
Running http_keepalive on uvloop...

http_keepalive
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.0163       49,017         52,758      199.5      0.290      0.299      0.567     30.3 MiB    0.0007     0.0152    0.0004   0.0000
rsloop         0.0225       35,527         55,826      144.6      0.279      0.315      0.344     32.1 MiB    0.0077     0.0143    0.0005   0.0000
Running tls_http on rsloop...
Running tls_http on uvloop...

tls_http
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.0528       15,144         26,412       61.6      0.595      0.628      0.801     35.1 MiB    0.0213     0.0300    0.0012   0.0000
rsloop         0.1296        6,175         51,264       25.1      0.303      0.345      0.443     46.8 MiB    0.1132     0.0178    0.0008   0.0000
Running websocket_messages on rsloop...
Running websocket_messages on uvloop...

websocket_messages
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.1424        5,617          5,687       15.7      2.674      2.963      3.126     30.8 MiB    0.0013     0.1407    0.0004   0.0000
rsloop         0.1551        5,159          5,414       14.4      2.771      3.565      3.959     31.8 MiB    0.0079     0.1478    0.0005   0.0000
Running mixed_streams on rsloop...
Running mixed_streams on uvloop...

mixed_streams
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.0220       36,353         38,198     1438.9      0.394      0.461      0.969     32.0 MiB    0.0007     0.0209    0.0004   0.0000
rsloop         0.0306       26,184         42,517     1036.4      0.359      0.394      0.697     34.5 MiB    0.0080     0.0188    0.0005   0.0000
Running bulk_transfer on rsloop...
Running bulk_transfer on uvloop...

bulk_transfer
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0246          651            990     1301.9     14.054     15.787     15.787     58.4 MiB    0.0076     0.0164    0.0006   0.0000
uvloop         0.0254          630            655     1260.0     18.864     24.353     24.353     53.0 MiB    0.0007     0.0244    0.0003   0.0000
Running idle_connections on rsloop...
Running idle_connections on uvloop...

idle_connections
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0538        3,715         25,036        0.0      2.309      6.191      6.509     36.9 MiB    0.0419     0.0080    0.0040   0.2002
uvloop         0.0585        3,417         10,199        0.0     16.730     17.495     17.779     32.0 MiB    0.0173     0.0196    0.0215   0.2004

@Vizonex

Vizonex commented Jul 21, 2026

Copy link
Copy Markdown

Not to get too off topic here but when it comes to tasks benchmarks I have an idea that may help you if your goal is to beat all the uvloop benchmarks and that is to create a new task object when no default factory is utilized. I have some concept work that you can borrow from if you wanted to do a bit more research later. https://gist.github.com/Vizonex/5196ae5fc7f2287df6a6dec8b37edc37 This has not been utilized at all yet but I see a reason to add this in after winloop is fully decommissioned and merged with uvloop. I don't know if coroutines will behave well with pyo3 but it's worth a shot.

Edit: the concept of coroutines and tasks and futures was rather simple. Bridge all the code instead of just portions of it. The most python-heavy parts of uvloop currently are the containers and awaitable objects. If all of that was killed off the interpreter would have a less costly time performing asynchronous work.

@egorsmkv

egorsmkv commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

windows:

PS C:\Users\egors\Downloads\rsloop> uv run --with winloop python benchmarks/compare_event_loops.py
Running callbacks on asyncio...
Running callbacks on winloop...
Running callbacks on rsloop...

callbacks (200,000 ops)
loop           median_s       best_s      ops_per_s     peak_rss   vs_fastest
rsloop         0.078770     0.063599      2,539,041     64.7 MiB        1.00x
winloop        0.090262     0.082038      2,215,769     72.6 MiB        1.15x
asyncio        0.182370     0.169503      1,096,674     64.0 MiB        2.32x
Running tasks on asyncio...
Running tasks on winloop...
Running tasks on rsloop...

tasks (50,000 ops)
loop           median_s       best_s      ops_per_s     peak_rss   vs_fastest
rsloop         0.150098     0.119943        333,115     36.4 MiB        1.00x
winloop        0.154036     0.145029        324,599     38.5 MiB        1.03x
asyncio        0.315483     0.262090        158,487     36.1 MiB        2.10x
tcp_streams mode: rsloop native fast streams
Running tcp_streams on asyncio...
Running tcp_streams on winloop...
Running tcp_streams on rsloop...

tcp_streams (5,000 ops)
loop           median_s       best_s      ops_per_s     peak_rss   vs_fastest
winloop        0.190080     0.180383         26,305     32.2 MiB        1.00x
asyncio        0.342125     0.303230         14,615     28.7 MiB        1.80x
rsloop         0.350581     0.336918         14,262     31.9 MiB        1.84x
PS C:\Users\egors\Downloads\rsloop> uv run --with winloop python benchmarks/workload_matrix.py   --loops rsloop,winloop
Running http_keepalive on rsloop...
Running http_keepalive on winloop...

http_keepalive
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
winloop        0.0416       19,251         22,536       78.4      0.621      1.153      1.528     34.8 MiB    0.0040     0.0355    0.0021   0.0000
rsloop         0.0441       18,137         23,780       73.8      0.642      0.887      1.376     35.7 MiB    0.0095     0.0336    0.0010   0.0000
Running tls_http on rsloop...
Running tls_http on winloop...

tls_http
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
winloop        0.1016        7,876         16,254       32.1      0.877      1.352      1.727     44.6 MiB    0.0487     0.0492    0.0037   0.0000
rsloop         2.1884          366         25,175        1.5      0.593      0.948      1.077     43.8 MiB    0.1228     0.0318    2.0339   0.0000
Running websocket_messages on rsloop...
Running websocket_messages on winloop...

websocket_messages
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.2150        3,721          3,919       10.4      3.842      6.024      7.294     35.4 MiB    0.0096     0.2041    0.0013   0.0000
winloop        0.2224        3,597          3,749       10.1      3.958      5.934      6.737     34.9 MiB    0.0048     0.2134    0.0015   0.0000
Running mixed_streams on rsloop...
Running mixed_streams on winloop...

mixed_streams
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0566       14,136         18,291      559.5      0.660      1.676      5.704     37.7 MiB    0.0116     0.0437    0.0012   0.0000
winloop        0.0568       14,086         15,997      557.5      0.793      1.332      2.336     36.4 MiB    0.0043     0.0490    0.0024   0.0000
Running bulk_transfer on rsloop...
Running bulk_transfer on winloop...

bulk_transfer
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0369          433            606      867.0     25.065     25.824     25.824     74.3 MiB    0.0097     0.0264    0.0008   0.0000
winloop        0.0665          241            262      481.1     55.761     60.867     60.867     68.8 MiB    0.0036     0.0611    0.0018   0.0000
Running idle_connections on rsloop...
Running idle_connections on winloop...

idle_connections
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
winloop        0.0753        2,654         11,803        0.0     15.041     15.573     15.722     36.6 MiB    0.0341     0.0169    0.0126   0.2119
rsloop         0.1630        1,227          8,858        0.0     15.196     19.249     19.867     42.6 MiB    0.1174     0.0226    0.0230   0.2020

@egorsmkv

Copy link
Copy Markdown
Contributor Author
PS C:\Users\egors\Downloads\rsloop> uv run --with winloop python benchmarks/workload_matrix.py   --loops rsloop,winloop
Running http_keepalive on rsloop...
Running http_keepalive on winloop...

http_keepalive
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
winloop        0.0339       23,587         26,554       96.0      0.569      0.882      0.961     33.8 MiB    0.0027     0.0301    0.0012   0.0000
rsloop         0.0367       21,796         28,296       88.7      0.508      0.820      1.086     34.5 MiB    0.0068     0.0283    0.0009   0.0000
Running tls_http on rsloop...
Running tls_http on winloop...

tls_http
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
winloop        0.1075        7,444         13,953       30.3      0.822      3.111      3.735     43.6 MiB    0.0464     0.0573    0.0032   0.0000
rsloop         0.1096        7,299         35,344       29.7      0.398      0.810      1.062     42.8 MiB    0.0863     0.0226    0.0024   0.0000
Running websocket_messages on rsloop...
Running websocket_messages on winloop...

websocket_messages
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.1948        4,107          4,294       11.5      3.538      4.826      5.287     34.5 MiB    0.0072     0.1863    0.0010   0.0000
winloop        0.1961        4,080          4,192       11.4      3.596      4.778      5.172     34.0 MiB    0.0039     0.1905    0.0015   0.0000
Running mixed_streams on rsloop...
Running mixed_streams on winloop...

mixed_streams
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0417       19,165         22,461      758.6      0.610      0.996      1.312     36.8 MiB    0.0066     0.0356    0.0008   0.0000
winloop        0.0423       18,905         20,858      748.3      0.667      1.190      1.749     35.5 MiB    0.0028     0.0384    0.0013   0.0000
Running bulk_transfer on rsloop...
Running bulk_transfer on winloop...

bulk_transfer
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0318          503            686     1006.0     20.993     22.726     22.726     74.6 MiB    0.0072     0.0233    0.0006   0.0000
winloop        0.0646          248            263      495.3     56.316     60.663     60.663     67.9 MiB    0.0029     0.0609    0.0011   0.0000
Running idle_connections on rsloop...
Running idle_connections on winloop...

idle_connections
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
winloop        0.0509        3,930         15,927        0.0     11.075     11.328     11.416     35.8 MiB    0.0292     0.0126    0.0105   0.2085
rsloop         0.0702        2,851         14,688        0.0      9.101     11.746     12.030     41.0 MiB    0.0428     0.0136    0.0120   0.2054

@egorsmkv

Copy link
Copy Markdown
Contributor Author
Running http_keepalive on rsloop...
Running http_keepalive on winloop...

http_keepalive
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0335       23,883         29,801       97.2      0.506      0.706      0.817     34.2 MiB    0.0058     0.0268    0.0009   0.0000
winloop        0.0341       23,479         26,708       95.6      0.553      0.905      1.029     33.7 MiB    0.0028     0.0300    0.0012   0.0000
Running tls_http on rsloop...
Running tls_http on winloop...

tls_http
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0710       11,265         36,704       45.9      0.392      0.710      0.836     41.8 MiB    0.0476     0.0218    0.0022   0.0000
winloop        0.0908        8,811         18,060       35.9      0.820      1.169      1.283     43.5 MiB    0.0424     0.0443    0.0032   0.0000
Running websocket_messages on rsloop...
Running websocket_messages on winloop...

websocket_messages
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.1825        4,385          4,569       12.3      3.331      4.665      5.143     34.4 MiB    0.0065     0.1751    0.0009   0.0000
winloop        0.1854        4,315          4,450       12.1      3.383      4.859      5.167     33.8 MiB    0.0040     0.1798    0.0012   0.0000
Running mixed_streams on rsloop...
Running mixed_streams on winloop...

mixed_streams
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
winloop        0.0405       19,766         21,967      782.4      0.659      1.277      1.753     35.6 MiB    0.0028     0.0364    0.0012   0.0000
rsloop         0.0408       19,584         24,115      775.2      0.611      0.898      1.086     36.6 MiB    0.0066     0.0337    0.0009   0.0000
Running bulk_transfer on rsloop...
Running bulk_transfer on winloop...

bulk_transfer
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0333          481            646      962.1     23.162     23.843     23.843     72.3 MiB    0.0076     0.0248    0.0008   0.0000
winloop        0.0555          288            310      576.8     47.582     51.435     51.435     67.8 MiB    0.0029     0.0516    0.0010   0.0000
Running idle_connections on rsloop...
Running idle_connections on winloop...

idle_connections
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
winloop        0.0568        3,522         15,189        0.0     11.157     11.728     11.843     35.6 MiB    0.0342     0.0125    0.0087   0.2043
rsloop         0.0593        3,373         19,462        0.0      5.675      8.380      8.829     40.8 MiB    0.0418     0.0101    0.0072   0.2109

@egorsmkv

Copy link
Copy Markdown
Contributor Author
PS C:\Users\egors\Downloads\rsloop> uv run --with winloop python benchmarks/compare_event_loops.py
Uninstalled 1 package in 2ms
Installed 1 package in 15ms
Running callbacks on asyncio...
Running callbacks on winloop...
Running callbacks on rsloop...

callbacks (200,000 ops)
loop           median_s       best_s      ops_per_s     peak_rss   vs_fastest
rsloop         0.052650     0.051826      3,798,670     63.8 MiB        1.00x
winloop        0.059574     0.058296      3,357,192     71.9 MiB        1.13x
asyncio        0.134419     0.130748      1,487,888     63.2 MiB        2.55x
Running tasks on asyncio...
Running tasks on winloop...
Running tasks on rsloop...

tasks (50,000 ops)
loop           median_s       best_s      ops_per_s     peak_rss   vs_fastest
rsloop         0.101884     0.100197        490,754     35.7 MiB        1.00x
winloop        0.112833     0.112167        443,134     37.6 MiB        1.11x
asyncio        0.188144     0.186134        265,754     35.3 MiB        1.85x
tcp_streams mode: rsloop native fast streams
Running tcp_streams on asyncio...
Running tcp_streams on winloop...
Running tcp_streams on rsloop...

tcp_streams (5,000 ops)
loop           median_s       best_s      ops_per_s     peak_rss   vs_fastest
winloop        0.144633     0.143586         34,570     31.4 MiB        1.00x
rsloop         0.158093     0.148345         31,627     30.8 MiB        1.09x
asyncio        0.256596     0.253453         19,486     28.1 MiB        1.77x
PS C:\Users\egors\Downloads\rsloop> uv run --with winloop python benchmarks/workload_matrix.py   --loops rsloop,winloop
Running http_keepalive on rsloop...
Running http_keepalive on winloop...

http_keepalive
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0347       23,039         28,670       93.8      0.513      0.764      0.904     34.5 MiB    0.0061     0.0279    0.0007   0.0000
winloop        0.0364       22,001         25,604       89.5      0.572      0.855      0.909     33.7 MiB    0.0031     0.0312    0.0012   0.0000
Running tls_http on rsloop...
Running tls_http on winloop...

tls_http
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0735       10,886         39,157       44.3      0.370      0.620      1.091     42.3 MiB    0.0504     0.0204    0.0026   0.0000
winloop        0.0879        9,100         17,625       37.0      0.820      1.582      1.922     43.5 MiB    0.0399     0.0442    0.0028   0.0000
Running websocket_messages on rsloop...
Running websocket_messages on winloop...

websocket_messages
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
winloop        0.1868        4,282          4,402       12.0      3.482      4.728      5.098     33.9 MiB    0.0036     0.1817    0.0013   0.0000
rsloop         0.1957        4,088          4,354       11.4      3.450      4.984      5.537     34.5 MiB    0.0081     0.1792    0.0073   0.0000
Running mixed_streams on rsloop...
Running mixed_streams on winloop...

mixed_streams
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
winloop        0.0411       19,457         21,531      770.1      0.677      1.107      1.481     35.5 MiB    0.0028     0.0369    0.0013   0.0000
rsloop         0.0447       17,893         20,991      708.2      0.615      1.181      5.076     36.6 MiB    0.0062     0.0381    0.0009   0.0000
Running bulk_transfer on rsloop...
Running bulk_transfer on winloop...

bulk_transfer
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0265          605            842     1209.7     18.127     18.486     18.486     72.2 MiB    0.0068     0.0190    0.0007   0.0000
winloop        0.0576          278            299      555.4     47.350     53.392     53.392     67.7 MiB    0.0032     0.0535    0.0012   0.0000
Running idle_connections on rsloop...
Running idle_connections on winloop...

idle_connections
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
winloop        0.0544        3,677         17,481        0.0      9.605      9.914      9.989     35.5 MiB    0.0354     0.0114    0.0076   0.2096
rsloop         0.0630        3,174         18,940        0.0      6.395      8.726      9.051     43.0 MiB    0.0431     0.0102    0.0093   0.2134

@egorsmkv

Copy link
Copy Markdown
Contributor Author
PS C:\Users\egors\Downloads\rsloop> uv run --with winloop python benchmarks/compare_event_loops.py
Uninstalled 1 package in 2ms
Installed 1 package in 16ms
Running callbacks on asyncio...
Running callbacks on winloop...
Running callbacks on rsloop...

callbacks (200,000 ops)
loop           median_s       best_s      ops_per_s     peak_rss   vs_fastest
rsloop         0.054236     0.053198      3,687,615     63.6 MiB        1.00x
winloop        0.060948     0.060670      3,281,507     71.9 MiB        1.12x
asyncio        0.131677     0.129988      1,518,872     63.2 MiB        2.43x
Running tasks on asyncio...
Running tasks on winloop...
Running tasks on rsloop...

tasks (50,000 ops)
loop           median_s       best_s      ops_per_s     peak_rss   vs_fastest
rsloop         0.101489     0.100812        492,667     35.8 MiB        1.00x
winloop        0.115830     0.114206        431,669     37.6 MiB        1.14x
asyncio        0.190465     0.189540        262,515     35.5 MiB        1.88x
tcp_streams mode: rsloop native fast streams
Running tcp_streams on asyncio...
Running tcp_streams on winloop...
Running tcp_streams on rsloop...

tcp_streams (5,000 ops)
loop           median_s       best_s      ops_per_s     peak_rss   vs_fastest
winloop        0.146921     0.143505         34,032     31.3 MiB        1.00x
rsloop         0.149940     0.146840         33,347     30.8 MiB        1.02x
asyncio        0.259754     0.256795         19,249     28.0 MiB        1.77x
PS C:\Users\egors\Downloads\rsloop> uv run --with winloop python benchmarks/workload_matrix.py   --loops rsloop,winloop
Running http_keepalive on rsloop...
Running http_keepalive on winloop...

http_keepalive
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0348       22,993         28,760       93.6      0.517      0.652      0.864     34.5 MiB    0.0057     0.0279    0.0012   0.0000
winloop        0.0360       22,204         25,965       90.4      0.564      1.016      1.344     33.8 MiB    0.0030     0.0308    0.0016   0.0000
Running tls_http on rsloop...
Running tls_http on winloop...

tls_http
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0694       11,535         40,076       46.9      0.372      0.536      0.613     41.7 MiB    0.0468     0.0200    0.0027   0.0000
winloop        0.0866        9,233         18,668       37.6      0.809      1.122      1.636     43.6 MiB    0.0411     0.0429    0.0028   0.0000
Running websocket_messages on rsloop...
Running websocket_messages on winloop...

websocket_messages
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.1831        4,368          4,558       12.2      3.359      4.571      4.987     34.5 MiB    0.0064     0.1755    0.0015   0.0000
winloop        0.1850        4,325          4,441       12.1      3.471      4.275      4.746     34.0 MiB    0.0036     0.1801    0.0012   0.0000
Running mixed_streams on rsloop...
Running mixed_streams on winloop...

mixed_streams
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0399       20,032         24,627      792.9      0.607      0.873      1.056     36.7 MiB    0.0060     0.0325    0.0016   0.0000
winloop        0.0436       18,332         20,658      725.6      0.712      1.036      1.866     35.5 MiB    0.0029     0.0387    0.0013   0.0000
Running bulk_transfer on rsloop...
Running bulk_transfer on winloop...

bulk_transfer
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0267          599            812     1198.6     18.650     19.148     19.148     74.3 MiB    0.0060     0.0197    0.0008   0.0000
winloop        0.0549          291            323      582.7     45.109     49.279     49.279     67.8 MiB    0.0029     0.0505    0.0009   0.0000
Running idle_connections on rsloop...
Running idle_connections on winloop...

idle_connections
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
winloop        0.0536        3,732         15,433        0.0     11.099     11.568     11.619     35.6 MiB    0.0336     0.0128    0.0071   0.2124
rsloop         0.0646        3,096         18,088        0.0      6.007      9.046      9.449     44.4 MiB    0.0396     0.0107    0.0133   0.2020

@egorsmkv

Copy link
Copy Markdown
Contributor Author

Linux:

devops@ml-lab2:~/Work/RustedBytes/rsloop$ uv run --with uvloop python benchmarks/compare_event_loops.py
Uninstalled 1 package in 0.28ms
Installed 1 package in 2ms
Running callbacks on asyncio...
Running callbacks on uvloop...
Running callbacks on rsloop...

callbacks (200,000 ops)
loop           median_s       best_s      ops_per_s   baseline_rss     peak_rss   peak_delta   vs_fastest
rsloop         0.044979     0.043590      4,446,543       26.4 MiB     62.8 MiB     36.4 MiB        1.00x
uvloop         0.048803     0.048555      4,098,123       25.6 MiB     68.6 MiB     43.0 MiB        1.09x
asyncio        0.104297     0.102025      1,917,601       24.1 MiB     60.0 MiB     35.8 MiB        2.32x
Running tasks on asyncio...
Running tasks on uvloop...
Running tasks on rsloop...

tasks (50,000 ops)
loop           median_s       best_s      ops_per_s   baseline_rss     peak_rss   peak_delta   vs_fastest
uvloop         0.084060     0.083460        594,812       25.6 MiB     34.2 MiB      8.7 MiB        1.00x
rsloop         0.086085     0.085562        580,824       26.4 MiB     34.2 MiB      7.7 MiB        1.02x
asyncio        0.137385     0.132928        363,940       24.2 MiB     31.7 MiB      7.5 MiB        1.63x
tcp_streams mode: rsloop native fast streams
Running tcp_streams on asyncio...
Running tcp_streams on uvloop...
Running tcp_streams on rsloop...

tcp_streams (5,000 ops)
loop           median_s       best_s      ops_per_s   baseline_rss     peak_rss   peak_delta   vs_fastest
rsloop         0.073768     0.071646         67,780       26.5 MiB     28.8 MiB      2.3 MiB        1.00x
uvloop         0.116915     0.116568         42,766       25.6 MiB     28.1 MiB      2.5 MiB        1.58x
asyncio        0.141266     0.137370         35,394       24.1 MiB     28.1 MiB      3.9 MiB        1.92x
devops@ml-lab2:~/Work/RustedBytes/rsloop$ uv run --with uvloop python benchmarks/workload_matrix.py   --loops rsloop,uvloop
Running http_keepalive on rsloop...
Running http_keepalive on uvloop...

http_keepalive
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.0162       49,531         53,302      201.6      0.286      0.305      0.567     30.4 MiB    0.0007     0.0150    0.0004   0.0000
rsloop         0.0222       36,029         55,950      146.6      0.277      0.326      0.335     31.5 MiB    0.0071     0.0143    0.0008   0.0000
Running tls_http on rsloop...
Running tls_http on uvloop...

tls_http
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.0510       15,674         27,529       63.8      0.572      0.582      0.777     35.3 MiB    0.0209     0.0291    0.0011   0.0000
rsloop         0.0617       12,966         63,789       52.8      0.246      0.268      0.329     38.7 MiB    0.0483     0.0123    0.0008   0.0000
Running websocket_messages on rsloop...
Running websocket_messages on uvloop...

websocket_messages
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.1428        5,602          5,674       15.7      2.681      2.913      3.113     30.9 MiB    0.0014     0.1410    0.0004   0.0000
rsloop         0.1541        5,192          5,458       14.5      2.764      3.605      4.037     32.1 MiB    0.0077     0.1466    0.0008   0.0000
Running mixed_streams on rsloop...
Running mixed_streams on uvloop...

mixed_streams
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.0224       35,664         37,481     1411.6      0.399      0.518      1.004     32.1 MiB    0.0007     0.0213    0.0004   0.0000
rsloop         0.0283       28,255         41,935     1118.4      0.365      0.399      0.718     34.2 MiB    0.0072     0.0191    0.0007   0.0000
Running bulk_transfer on rsloop...
Running bulk_transfer on uvloop...

bulk_transfer
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.0260          616            640     1232.1     19.486     24.922     24.922     53.0 MiB    0.0007     0.0250    0.0003   0.0000
rsloop         0.0382          419            555      837.9     27.924     28.447     28.447     96.6 MiB    0.0083     0.0287    0.0007   0.0000
Running idle_connections on rsloop...
Running idle_connections on uvloop...

idle_connections
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0603        3,315         27,075        0.0      2.157      5.543      5.878     36.4 MiB    0.0448     0.0081    0.0081   0.2003
uvloop         0.0622        3,214         10,102        0.0     16.926     17.722     17.977     31.9 MiB    0.0207     0.0198    0.0218   0.2003

@egorsmkv

Copy link
Copy Markdown
Contributor Author

macOS:

yehorsmoliakov@Yehors-MacBook-Air ~/D/rsloop (compio-vs-vibeio)> uv run --with uvloop python benchmarks/compare_event_loops.py
Running callbacks on asyncio...
Running callbacks on uvloop...
Running callbacks on rsloop...

callbacks (200,000 ops)
loop           median_s       best_s      ops_per_s     peak_rss   vs_fastest
rsloop         0.032415     0.031970      6,170,070     67.7 MiB        1.00x
uvloop         0.044235     0.039705      4,521,307     72.9 MiB        1.36x
asyncio        0.081783     0.080023      2,445,503     65.3 MiB        2.52x
Running tasks on asyncio...
Running tasks on uvloop...
Running tasks on rsloop...

tasks (50,000 ops)
loop           median_s       best_s      ops_per_s     peak_rss   vs_fastest
rsloop         0.061973     0.061354        806,803     38.0 MiB        1.00x
uvloop         0.068145     0.067012        733,728     38.2 MiB        1.10x
asyncio        0.107557     0.105342        464,871     36.1 MiB        1.74x
tcp_streams mode: rsloop native fast streams
Running tcp_streams on asyncio...
Running tcp_streams on uvloop...
Running tcp_streams on rsloop...

tcp_streams (5,000 ops)
loop           median_s       best_s      ops_per_s     peak_rss   vs_fastest
rsloop         0.098566     0.097288         50,727     32.3 MiB        1.00x
uvloop         0.131733     0.128223         37,956     31.5 MiB        1.34x
asyncio        0.301024     0.250898         16,610     29.6 MiB        3.05x
yehorsmoliakov@Yehors-MacBook-Air ~/D/rsloop (compio-vs-vibeio)> uv run --with uvloop python benchmarks/workload_matrix.py --loops rsloop,uvloop
Running http_keepalive on rsloop...
Running http_keepalive on uvloop...

http_keepalive
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.0136       58,991         63,080      240.1      0.223      0.345      0.418     34.3 MiB    0.0007     0.0127    0.0002   0.0000
rsloop         0.0148       54,024         62,538      219.9      0.241      0.357      0.402     36.1 MiB    0.0014     0.0128    0.0006   0.0000
Running tls_http on rsloop...
Running tls_http on uvloop...

tls_http
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.0429       18,668         34,535       76.0      0.427      0.571      0.606     39.8 MiB    0.0189     0.0232    0.0008   0.0000
rsloop         0.6397        1,251         49,417        5.1      0.297      0.475      0.484     46.9 MiB    0.6226     0.0157    0.0008   0.0000
Running websocket_messages on rsloop...
Running websocket_messages on uvloop...

websocket_messages
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.1260        6,351          6,415       17.8      2.378      2.909      3.131     34.5 MiB    0.0012     0.1247    0.0002   0.0000
rsloop         0.1313        6,094          6,199       17.0      2.484      3.355      3.673     36.2 MiB    0.0016     0.1290    0.0007   0.0000
Running mixed_streams on rsloop...
Running mixed_streams on uvloop...

mixed_streams
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.0202       39,576         42,191     1566.5      0.354      0.522      0.727     36.5 MiB    0.0008     0.0190    0.0002   0.0000
rsloop         0.0234       34,176         37,158     1352.7      0.368      0.916      1.052     38.3 MiB    0.0014     0.0215    0.0005   0.0000
Running bulk_transfer on rsloop...
Running bulk_transfer on uvloop...

bulk_transfer
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
rsloop         0.0165          968          1,085     1936.2     13.474     14.545     14.545     72.4 MiB    0.0013     0.0147    0.0002   0.0000
uvloop         0.0195          820            869     1639.5     17.406     18.341     18.341     95.7 MiB    0.0009     0.0184    0.0002   0.0000
Running idle_connections on rsloop...
Running idle_connections on uvloop...

idle_connections
loop         median_s  total_ops/s  traffic_ops/s      MiB/s     p50_ms     p95_ms     p99_ms     peak_rss   setup_s  traffic_s   close_s   idle_s
uvloop         0.0548        3,649         29,376        0.0      5.071      5.577      5.659     36.0 MiB    0.0442     0.0060    0.0032   0.2011
rsloop         0.0637        3,139         38,362        0.0      3.115      3.617      3.693     45.7 MiB    0.0523     0.0052    0.0073   0.2011

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.

2 participants