| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
First, great work on this, this is legitimately a cool PR. That said, I'm feeling really uneasy about _PyEval_StopTheWorld. Maybe instead of this approach we try spin locks + a custom mini hash map data structure? That would obviously be a lot more work, but a cleaner and ultimately better perf approach. Also please wait for reviews from @pablogsal and @ambv. I'm curious if this would make external introspection harder. |
Sorry, something went wrong.
|
Does this work where an event loop is used on one thread, stopped then resumed on another thread? |
Sorry, something went wrong.
|
I have pushed some more changes:
TODO: benchmark it before merging |
Sorry, something went wrong.
There was a problem hiding this comment.
If I am not mistaken this solution seems incompatible with the asyncio introspecction workflow we are adding on #124640. Please, ensure that this change is compatible with the changes in that PR to avoid problems in the future.
Sorry, something went wrong.
|
When you're done making the requested changes, leave the comment: I have made the requested changes; please review again. |
Sorry, something went wrong.
This PR has nothing to do with asyncio introspection. As I said in other PR, the change which would affect that is moving current task to per-loop which isn't done in this PR. |
Sorry, something went wrong.
|
Hummm, I must have misread how this affects the task management. Let me dismiss my request for changes meanwhile. Thanks for the patience with this @kumaraditya303! |
Sorry, something went wrong.
There was a problem hiding this comment.
This LGTM, but would you please also get this reviewed by another asyncio expert?
Sorry, something went wrong.
…#128869) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
…#128869) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
| Back | FazBrowse Home | New Git URL |
Use per-thread linked list of tasks in asyncio. This design allows for lock free register/unregister of tasks of loops running concurrently in different threads. It uses the stop the world pause to traverse the list of tasks from all threads from the thread where all_tasks is called. This has no performance impact on regular builds as per benchmarks and performs a bit faster on free-threading benchmarks. pyperformance benchmarks aren't good for this because it uses just one thread so there is little lock contention, this however performs much better when multiple threads are running.
On free-threading:
Benchmark hidden because not significant (1): asyncio_websockets