Merged
Conversation
Event loop worker pool inspired by libuv's "one loop per thread" model. Each loop has its own worker and maintains event ordering. Process affinity: All tasks from the same Erlang process are routed to the same event loop (via PID hash), guaranteeing that timers and related async operations execute in order. Changes: - py_event_loop_pool.erl: Rewrite with process affinity, persistent_term for O(1) access, distributed task API (create_task, run, spawn_task, await) - py_event_loop.erl: Export get_process_env/0 for pool use - py_event_loop_pool_SUITE.erl: New test suite (9 tests) - bench_event_loop_pool.erl: New benchmark Configuration: - event_loop_pool_size: Number of loops (default: schedulers count) Benchmarks (Python 3.14, 14 schedulers): - Sequential (pool): 150k tasks/sec (vs 83k single loop) - Concurrent (50 procs): 164k tasks/sec - Fire-and-collect: 417k tasks/sec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Benchmarks (Python 3.14, 14 schedulers)
Configuration
{event_loop_pool_size, N} % default: schedulers count