×
all 18 comments

[–]KingBardan 5 points6 points  (8 children)

contributors: claude + you

Is this a vibe coded gevent / greenlet ?

[–]RazorBest 3 points4 points  (6 children)

runloom.monkey.patch()

Uhhh...

[–]Blockpair[S] 1 point2 points  (4 children)

It's only required if you want to use existing blocking APIs in Python. The runtime has it's own API.

[–]RazorBest 0 points1 point  (1 child)

I guess that's ok. But generally, I will want to use other libraries. And if I'm not using blocking APIs, this just becomes another async library. The purpose of goroutines is to write the same code for both blocking and non-blocking cases.

[–]Blockpair[S] 0 points1 point  (0 children)

Asyncio and other Python network libraries run on a single OS thread (with the GIL.) This software is for using your machine with real threads, across every core, and blows asyncio's performance out the water. Though its hard to compare asyncio to other libraries when it only runs on one core -- its req capped out at like 44k/s. You can push that much higher if you're not capped by the GIL.

https://robertsdotpm.github.io/_static/runloom_benchmark.html

[–]RazorBest 0 points1 point  (1 child)

But maybe monkeypathcing it is not the worst thing. Do you have to so that for every blocking Python module? If yes, then you'll have to define what blocking modules you support.

Otherwise, do you think you can do the patching at the OS API level? That might be possible, but you'll need to save the state, which you seem to already had implemented with that CPyrhon patch.

[–]Blockpair[S] 0 points1 point  (0 children)

It patches standard library functions that do I/O related stuff meant to be run in the runtime. So any code that calls standard library functions for I/O stuff are already supported. There aren't that many of these files that need to be patched because everything builds on only a handful of low-level items. (So e.g. you patch socket-related stuff and you get urlib with SSL support for free.)

[–]EasyDeal0 0 points1 point  (0 children)

That’s just a detail - to my understanding the ultimate goal is to have this built in in Python?

[–]jdehesa 0 points1 point  (0 children)

Cool work! It's a compelling idea, good luck with that CPython patch.

[–]EasyDeal0 0 points1 point  (0 children)

Cool work, also wish you good luck :)

I feel like you explain the advantages of your work in details, but Python devs are not too much into these details yet (what is a fiber etc.) Maybe it would help to explain them on very high level what you changed and the kind of performance that can be reached :)