Skip to content

Event loop performance optimizations#34

Merged
benoitc merged 5 commits intomainfrom
feature/event-loop-optimization-v2
Mar 17, 2026
Merged

Event loop performance optimizations#34
benoitc merged 5 commits intomainfrom
feature/event-loop-optimization-v2

Conversation

@benoitc
Copy link
Owner

@benoitc benoitc commented Mar 17, 2026

Summary

  • Fix capsule init bug: initialize pending_capacity after memset
  • Coalesce task_ready messages to reduce mailbox amplification
  • Drain sockets to EAGAIN with budget (16 iterations) in transport callbacks
  • Fix race condition by removing persistent_term cache
  • Fix venv_info to check both state attributes
  • Handle erlang.ProcessError in async task result sends

- Fix capsule init bug: initialize pending_capacity after memset
- Cache loop reference in persistent_term for O(1) lookup
- Coalesce task_ready messages to reduce mailbox amplification
@benoitc benoitc force-pushed the feature/event-loop-optimization-v2 branch from ae39112 to cb4354a Compare March 17, 2026 11:37
benoitc added 4 commits March 17, 2026 12:51
- TCP/UDP _read_ready: loop up to 16 reads until EAGAIN
- TCP _write_ready_cb: loop up to 16 writes until EAGAIN
- Add note for future native task queue optimization
The persistent_term cache for loop_ref could return a reference being
destroyed during shutdown, causing ASAN errors. Revert to gen_server:call
for safety.
Check both _active_venv and _venv_site_packages exist before returning
active venv info, preventing errors from partial venv state.
Catch ProcessError when sending async task results back to caller.
If the caller process is gone, silently ignore the send failure.
@benoitc benoitc force-pushed the feature/event-loop-optimization-v2 branch from cb4354a to 2df726e Compare March 17, 2026 12:48
@benoitc benoitc merged commit fd8cef6 into main Mar 17, 2026
10 of 11 checks passed
@benoitc benoitc deleted the feature/event-loop-optimization-v2 branch March 17, 2026 13:05
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.

1 participant