Skip to content

Conversation

@v1rtl
Copy link
Member

@v1rtl v1rtl commented Feb 1, 2026

  • Pre-compile regex at middleware registration time instead of lazily on first request
  • Replace object spread with Object.assign for params merging to avoid allocations
  • Use arrow functions instead of .bind() for fresh/stale getters
  • Make stale property a lazy getter instead of eagerly evaluating
  • Remove duplicate host string indexOf check

@v1rtl v1rtl force-pushed the perf-improvements branch from a456500 to 8fdab14 Compare February 1, 2026 15:37
v1rtl and others added 6 commits February 2, 2026 12:38
- Pre-compile regex at middleware registration time instead of lazily on first request
- Replace object spread with Object.assign for params merging to avoid allocations
- Use arrow functions instead of .bind() for fresh/stale getters
- Make stale property a lazy getter instead of eagerly evaluating
- Remove duplicate host string indexOf check

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Extract HEAD handler middleware to shared module-level constant
- Inline method/exclusion filtering into #find() to avoid intermediate array
- Remove currying from handle() to avoid creating new function per middleware call

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds a test verifying that middleware is only executed once even when
it would match the URL multiple times during request processing. This
exercises the exclude.includes(m) branch in the #find() method.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds a test that calls multiple accepts methods (accepts, acceptsEncodings,
acceptsCharsets, acceptsLanguages) on the same request to exercise the
lazy caching branch in getAcceptsInstance().

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add tests for precompiled regex usage, static routes with false keys,
and wildcard key normalization to improve router branch coverage.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@v1rtl v1rtl force-pushed the perf-improvements branch from e97639f to 1ab0ca1 Compare February 2, 2026 10:39
- Add c8 ignore comment for ?? operator branch that V8 coverage
  doesn't track correctly despite being tested
- Remove hardcoded port 3000 in app.test.ts to prevent "Address in use"
  errors when port is occupied

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@v1rtl v1rtl marked this pull request as ready for review February 2, 2026 11:41
@v1rtl v1rtl merged commit 7221030 into master Feb 2, 2026
15 of 16 checks passed
@v1rtl v1rtl deleted the perf-improvements branch February 2, 2026 16:28
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