Skip to content

perf: improve body read performance#311

Merged
yusukebe merged 1 commit intopref/request-v2from
perf/body-read-4
Mar 12, 2026
Merged

perf: improve body read performance#311
yusukebe merged 1 commit intopref/request-v2from
perf/body-read-4

Conversation

@usualoma
Copy link
Member

@usualoma usualoma commented Mar 1, 2026

This PR applies fixes to maintain compatibility with web standards for the request body optimization merged in #301.

It seems we can implement this without significantly reducing the performance gains, but it will likely require a considerable amount of code. Maintenance costs also look substantial.

============================================================
BENCHMARK RESULTS
============================================================

| Benchmark         | npm            | dev            | Difference  |
| ----------------- | -------------- | -------------- | ----------- |
| Average           | 50,527.59      | 61,093.99      | +20.91%     |
| Ping (GET /)      | 65,812.06      | 70,197.87      | +6.66%      |
| Query (GET /id)   | 64,671.18      | 69,099.75      | +6.85%      |
| Body (POST /json) | 21,099.52      | 43,984.34      | +108.46%    |

@usualoma usualoma force-pushed the perf/body-read-4 branch 2 times, most recently from 6459306 to d05b374 Compare March 8, 2026 05:31
@usualoma usualoma marked this pull request as ready for review March 8, 2026 05:38
@usualoma
Copy link
Member Author

usualoma commented Mar 8, 2026

Hi @yusukebe

It's worth noting that a considerable amount of code is required, but I don't believe the complexity is so overwhelming that it becomes unmanageable if issues arise. Considering the significant speed improvement, accepting this level of complexity as a trade-off seems reasonable. (Plus, we can leverage AI for maintenance.)

What do you think? If it's acceptable, please merge this.

With this PR, I assume my additions to pref/request-v2 (oops, I mistyped the branch name) are complete.

@yusukebe
Copy link
Member

Hi @usualoma, I'll review this soon.

On my machine (MacBook Pro / M4 Pro) the benchmark result is below. Though, it is wonderful:

CleanShot 2026-03-11 at 21 12 37@2x

Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yusukebe
Copy link
Member

Hey @usualoma

Looks great to me! I'll merge this into the perf/request-v2 now. And, maybe, I will create a new branch to prepare for releasing v2. Thanks!

@yusukebe yusukebe merged commit 86504a1 into pref/request-v2 Mar 12, 2026
@yusukebe yusukebe deleted the perf/body-read-4 branch March 12, 2026 00:06
@yusukebe
Copy link
Member

Hey @usualoma !

I created the v2 branch and opened a PR #316 to merge v2 into main. But the CI fails https://github.com/honojs/node-server/actions/runs/22981070902/job/66720784480?pr=316

This is because a CI did not run on this PR's branch, so you missed the error. Can you take a look at it and fix the code so it passes CI? Thanks.

@usualoma
Copy link
Member Author

Oh, sorry, I forgot to test it after making some last-minute adjustments.

@yusukebe
Copy link
Member

@usualoma No problem!

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.

2 participants