Closed Bug 2074467 Opened 2 months ago Closed 1 month ago

BLAKE3 JS implementation is slower than in Chrome

Categories

(Core :: JavaScript Engine: JIT, defect, P3)

defect

Tracking

()

RESOLVED FIXED
159 Branch
Tracking Status
firefox159 --- fixed

People

(Reporter: jandem, Assigned: iain)

References

()

Details

Attachments

(1 file, 3 external files)

This was posted on Bluesky.

https://bsky.app/profile/ianopolous.bsky.social/post/3mvv2odg4hc2p
https://peergos.github.io/blake3-speed/

On my Mac we get ~800 MiB/s and Chrome 1080 MiB/s so the gap is a bit smaller.

Strangely enough, Safari is way slower, not sure if that's a problem with my machine.

On Windows arm64 on Firefox 158 vs Chrome Canary I get 667 vs 1053

(In reply to Jan de Mooij [:jandem] from comment #0)

Strangely enough, Safari is way slower, not sure if that's a problem with my machine.

People get 15-20 MiB/s with Safari 26. It seems to be fixed in Safari 27.

Attached file JS shell version —

Here's a JS shell version.

Claude analyzed our generated Ion code and it thinks the main issue is that we're not using rotate instructions for certain bitwise operations in the JS code.

Severity: -- → S3
Priority: -- → P3
Assignee: nobody → iireland
Status: NEW → ASSIGNED

This code was added in this commit while backing out a patch. However, looking at D59340, the original comment + setGuard() were on MWasmResultBase, not MRotate. It seems like there was some sort of undetected merge failure. I don't see any reason that this node has to be a guard.

This stack's effect is significant!

x64 (Ryzen 9 9950X)

Before

best 5.57 ms  median 5.58 ms  => 718 MiB/s (best), 717 MiB/s (median)

After

best 3.75 ms  median 3.76 ms  => 1065 MiB/s (best), 1064 MiB/s (median)

Node.js 26.10.0

(with print = console.log)

best 2.89 ms  median 3.37 ms  => 1386 MiB/s (best), 1188 MiB/s (median)

loong64 (Loongson 3B6000 12C24T)

Before

best 23.39 ms  median 23.41 ms  => 171 MiB/s (best), 171 MiB/s (median)

After

best 13.17 ms  median 13.17 ms  => 304 MiB/s (best), 304 MiB/s (median)

Node.js 26.9.0

(with print = console.log)

best 9.88 ms  median 9.89 ms  => 405 MiB/s (best), 405 MiB/s (median)

Yeah, those speedups look similar to what I was seeing locally.

Blocks: 2075098
Regressions: 2075982
QA Whiteboard: [qa-triage-done-c160/b159]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: