deno
bf55a80e - perf(ext/fetch): cache Headers iteration for all guard types

Commit
214 days ago
perf(ext/fetch): cache Headers iteration for all guard types The `_iterableHeaders` getter was rebuilding the sorted entries array on every access for non-immutable Headers (guard !== "immutable"), which is the common case for user-created Headers objects. This caused ~60x slower iteration compared to a Map. Cache the computed entries for all guard types and invalidate on mutation (append, set, delete). This reduces the gap from ~60x to ~3x. Closes #20980 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Parents
Loading