Commit c530ce2
committed
Optimize nif_process_ready_tasks for ~15% performance improvement
- Replace asyncio.iscoroutine() with PyCoro_CheckExact C API (~2-3us/task)
- Use stack buffers for module/func strings instead of enif_alloc (~0.5-1us/task)
- Cache asyncio.events module alongside cached_asyncio (~1-2us/call)
- Pool ErlNifEnv allocations with 64-entry pool using enif_clear_env (~1-2us/task)
- Add mutex protection to env pool for thread safety
Target: reduce from ~53us to ~45-47us per call in submit_task flow.1 parent e631349 commit c530ce2
2 files changed
Lines changed: 143 additions & 61 deletions
0 commit comments