New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: optimization of request instantiation #3107
base: main
Are you sure you want to change the base?
Conversation
tsctx
commented
Apr 13, 2024
- Reuse fetch optimization logic in core.
- Avoid lowercasing.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3107 +/- ##
==========================================
- Coverage 94.17% 94.16% -0.02%
==========================================
Files 90 90
Lines 24320 24320
==========================================
- Hits 22904 22901 -3
- Misses 1416 1419 +3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to combine method validation and normalization into a single method? This instantly breaks the second we need one and not the other.
The reason for wanting to normalize and verify at the same time is that the case used in the verification can be reused.
Yes, it is. The function was not changed, but a new one was created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you share the bench results?
import Request from "../../lib/core/request.js";
import DecoratorHandler from "../../lib/handler/decorator-handler.js";
import { bench, group, run } from 'mitata'
const handler = new DecoratorHandler({})
bench('new Request()', () => {
return new Request('https://localhost', { path: "/", method: "get", body: null }, handler);
})
await run()
|
Thank you for the benchmark. Can you add it to the benchmark folder please? |