Conversation
|
Hey @usualoma I realized that the current v2 branch is not fast on I think the changes like #310 decrease the performance. If so, it's a waste to use the changes. But there are still some points for performance improvement. The first one is this PR. Plus, another one is #320
Combining both PR will make it faster. I think it's enough as an "appeal point" for the major release. What do you think of it? If it makes sense for you, please review the PRs. |
|
Hi @yusukebe! Thanks for the follow-up! Given this approach, since diff --git i/src/request.ts w/src/request.ts
index 67c29f7..f88b98e 100644
--- i/src/request.ts
+++ w/src/request.ts
@@ -367,7 +367,7 @@ const readBodyDirect = (request: Record<string | symbol, any>): Promise<Buffer>
const requestPrototype: Record<string | symbol, any> = {
get method() {
- return (this[methodKey] ||= normalizeIncomingMethod(this[incomingKey].method))
+ return this[methodKey]
},
get url() {
@@ -536,6 +536,7 @@ export const newRequest = (
) => {
const req = Object.create(requestPrototype)
req[incomingKey] = incoming
+ req[methodKey] = normalizeIncomingMethod(incoming.method)
const incomingUrl = incoming.url || ''
|
Caching the method-key to improving performance.