Skip to content

Conversation

@Ayoub-Mabrouk
Copy link

Optimizes neverIndex lookup by replacing Array.includes() with SafeSet.has() for O(1) lookup performance.

  • SafeSet instead of Array: O(1) hash-based lookup vs O(n) linear search
  • for loop instead of .map(): Direct Set construction avoids intermediate array allocation

Replace array-based neverIndex lookup with SafeSet for O(1) lookup
performance. This improves buildNgHeaderString performance from
O(n) to O(1) per header, providing significant speedup in hot path
scenarios with many headers.
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/http2
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added http2 Issues or PRs related to the http2 subsystem. needs-ci PRs that need a full CI run. labels Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

http2 Issues or PRs related to the http2 subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants