Skip to content

Conversation

@anonrig
Copy link
Member

@anonrig anonrig commented Oct 31, 2025

Improves Next.js benchmarks by 4-7% and WebAssembly applications by 5%

Important disclaimer: Codspeed will not show any improvement (although you can look into previous edits of the codspeed post) because this change is behind an autogate.


Sharing @mhart's benchmark results:

Before:

  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    17.63ms    7.86ms 102.29ms   87.71%
    Req/Sec    57.83      9.24    80.00     75.59%
  Latency Distribution
     50%   14.25ms
     75%   17.30ms
     90%   33.63ms
     99%   41.37ms
  1736 requests in 30.06s, 517.73MB read
Requests/sec:     57.75

After:

  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    16.96ms    9.48ms 145.37ms   88.17%
    Req/Sec    61.43      9.89    80.00     74.92%
  Latency Distribution
     50%   13.27ms
     75%   16.94ms
     90%   32.61ms
     99%   41.71ms
  1842 requests in 30.05s, 549.21MB read
Requests/sec:     61.30

This is pretty consistent over multiple runs. Seeing 1.04x - 1.07x


Claude is used to write documentation in encoding-test.c++.

@anonrig anonrig requested review from a team as code owners October 31, 2025 14:50
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 31, 2025

CodSpeed Performance Report

Merging #5448 will not alter performance

Comparing yagiz/experiment-value-view (1a2eab7) with main (49feab0)

Summary

✅ 140 untouched
⏩ 38 skipped1

Footnotes

  1. 38 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@anonrig anonrig force-pushed the yagiz/experiment-value-view branch from 30c0921 to 2259fce Compare October 31, 2025 17:18
@anonrig anonrig changed the title experiment with value view and simdutf improve text encoder encode performance Oct 31, 2025
@jasnell
Copy link
Collaborator

jasnell commented Nov 3, 2025

Looks like there are still some bugs to work out here with the failing CI... but even then, my preference would be to settle on #5449 first before landing any changes here. Also, since we do utf8 conversions everywhere, not just in TextEncoder::encode, my preference would be to address this more generally. That is, the optimized encoding path -- if we decide it's worthwhile -- should go into jsg::JsString so that it can be used everywhere rather than just in TextEncoder::encode.

@anonrig anonrig force-pushed the yagiz/experiment-value-view branch 2 times, most recently from 98afb46 to f1bbfe6 Compare November 3, 2025 17:15
@anonrig anonrig force-pushed the yagiz/experiment-value-view branch from 7fac631 to 681bf71 Compare November 3, 2025 17:50
@anonrig anonrig force-pushed the yagiz/experiment-value-view branch 3 times, most recently from 3a6ea76 to 6e3972e Compare November 3, 2025 20:04
@erikcorry
Copy link
Contributor

I don't think we need to speed optimize for the broken UTF-16 case unless and until someone shows it matters. The only reason to space-optimize would be to avoid throwing OOM, so if we can guarantee that doesn't happen I'm OK with some temporary blowup in space too.

@erikcorry
Copy link
Contributor

https://paste.cfdata.org/GKKdyFGFqSks

@anonrig
Copy link
Member Author

anonrig commented Nov 3, 2025

https://paste.cfdata.org/GKKdyFGFqSks

This helps a lot. I'll push with your changes. Thanks @erikcorry

@anonrig anonrig force-pushed the yagiz/experiment-value-view branch from bea0ed3 to 166e9fd Compare December 29, 2025 23:22
@anonrig anonrig requested a review from jasnell December 30, 2025 16:22
@anonrig anonrig force-pushed the yagiz/experiment-value-view branch 2 times, most recently from 572cc71 to cad9175 Compare December 30, 2025 17:13
@anonrig anonrig force-pushed the yagiz/experiment-value-view branch from cad9175 to 1a2eab7 Compare December 30, 2025 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants