Skip to content

[Backport 5.x] perf: reduce content-type parser overhead - #7019

Merged
gurgunday merged 2 commits into
5.xfrom
backport-7012-to-5.x
Sep 11, 2026
Merged

gurgunday merged 2 commits into
5.xfrom
backport-7012-to-5.x

Conversation

@github-actions

Copy link
Copy Markdown

Backport d1dd890 from #7012.

This PR does 2 things:

* Replace AsyncResource.bind() with a callback that still preserves
async scope (this is an optimization I've seen in Node.js, I believe by
@mcollina)
* Cache parameterized content-type parser matches

```sh
   Existing command                   Before            After    Change
  ━━━━━━━━━━━━━━━━━━━━━━━━━━  ━━━━━━━━━━━━━━━  ━━━━━━━━━━━━━━━  ━━━━━━━━
   npm run benchmark:parser    123,106 req/s    161,468 req/s    +31.2%
  ──────────────────────────  ───────────────  ───────────────  ────────
   npm run benchmark           201,041 req/s    201,310 req/s    +0.13%
```

Signed-off-by: Gürgün Dayıoğlu <[email protected]>
(cherry picked from commit d1dd890)
@gurgunday
gurgunday requested a review from a team September 10, 2026 11:28
@climba03003

Copy link
Copy Markdown
Member

It means that the published package also have wrong version number.

@gurgunday

gurgunday commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

@climba03003 yes, should we not include this fix in the PR? We need to fix it either here or with a separate commit

@gurgunday
gurgunday requested a review from mcollina September 10, 2026 18:20
gurgunday
gurgunday previously approved these changes Sep 11, 2026
@climba03003

Copy link
Copy Markdown
Member

@climba03003 yes, should we not include this fix in the PR? We need to fix it either here or with a separate commit

Synced the version and published new version.

@gurgunday
gurgunday merged commit 990ebef into 5.x Sep 11, 2026
59 checks passed
@gurgunday
gurgunday deleted the backport-7012-to-5.x branch September 11, 2026 11:19
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.

3 participants