Commit 9a3faca
committed
Add lazy header conversion for ASGI scope optimization
Implement LazyHeaderList Python type that converts headers on-demand
instead of eagerly converting all headers when building ASGI scope.
Key changes:
- LazyHeaderList with sequence protocol (__len__, __getitem__, __iter__)
- LazyHeaderListIter for iteration support
- NIF resource (lazy_headers_resource_t) holds copied header data
- Threshold of 4 headers (smaller lists use eager conversion)
- Headers cached after first access for repeated lookups
This completes all 6 ASGI NIF optimizations with expected total
improvement of 40-60% for typical ASGI workloads.1 parent 19b28fc commit 9a3faca
5 files changed
Lines changed: 1077 additions & 67 deletions
0 commit comments