You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf: optimize hot path performance in request handling (#485)
* perf: optimize hot path performance in request handling
- 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>
* perf: reduce allocations in request handler hot path
- 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>
* test: add explicit test for middleware exclusion in #find()
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>
* test: add test for Accepts instance caching in extend.ts
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>
* chore: changeset
* test: add coverage tests for pushMiddleware and normalizeKeys
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>
* fix: add c8 ignore for V8 coverage quirk and use random port in test
- 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>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
0 commit comments