Matthias Liedtke
Matthias Liedtke
@liedtke.bsky.social
Working on WebAssembly / wasm in V8 | Opinions are my own
Wasm code only tiers up after many calls / loop iterations (per function), another guess could be that arm64's native instructions might be more suitable for this use case. Potentially the relaxed SIMD feature can help. ("-mrelaxed-simd" in emscripten?)
github.com
August 22, 2025 at 11:53 PM
3.7x slowdown is a lot.
Have you tried running it in a JS loop many times to see if the numbers get better over time? Chrome uses tiered compilation and your measurements might only hit the baseline compiler.
August 22, 2025 at 11:03 PM
Great for anyone learning English:
1) Homophones: air and heir, weather and whether, ate and eight
2) Heteronyms: read, wind, tear
3) Heteronyms where the stressed syllable changes: content, produce, object
English Makes No Sense: Eight vs. Height
YouTube video by Loic Suberville
youtube.com
August 18, 2025 at 9:29 PM
V8 requires SSE4.1 for Wasm SIMD support on x86 (github.com/v8/v8/blob/m...), so desktop CPUs <15 years old should support it afaict?
github.com
August 14, 2025 at 10:37 AM
I'm not sure if JSPI covers these use cases but the Wasm stack switching proposal should: github.com/WebAssembly/...
The experimental implementation in V8 has been started but is still in an early state afaict.
github.com
May 8, 2025 at 8:35 PM
Unfortunately, the inlining hints part of the compilation hints proposal has not been implemented in V8, yet.
March 30, 2025 at 8:08 PM
1MB sounds like a lot. May I ask if you use binaryen for additional wasm-to-wasm optimizations?
March 27, 2025 at 10:21 PM
For wasm this was seen as an issue and addressed with the introduction of memory64: github.com/WebAssembly/...
It doesn't however mean that a web application should use more than 4 GB of linear memory. :)
github.com
February 18, 2025 at 9:29 PM
For the conversion between wasm-gc arrays and strings, there is a GitHub issue for it: github.com/WebAssembly/...
(But it will probably not be addressed soon as the current proposal is already stage 4, so it would require a new one.)
Fast conversion to/from ASCII/one-byte strings? · Issue #44 · WebAssembly/js-string-builtins
It's a near universal optimization within JS implementations to split strings into two representations: a one-byte and a two-byte. Even the size-optimized runtime XS does it. It brings a massive sp...
github.com
January 27, 2025 at 11:05 PM
If you only need quick access to UInt8Arrays, in v8 if you exactly import "Function.prototype.call.bind(DataView.prototype.getUint8)", it will perform a direct built-in call without first calling to JS (this is only supported for specific JS functions like data view getters and setters).
January 27, 2025 at 11:03 PM
Also, as your blog post uses user space JS interop: the wasm community group is exploring richer interop that could include attaching prototypes to wasm objects: github.com/WebAssembly/...
The wasm objects would still be opaque but a toolchain could e.g. install functions like the "res.is_ok()".
Proposal: Custom RTTs, Type-Associated Data, and WasmGC JS Interop · Issue #1552 · WebAssembly/design
WebAssembly structs and other heap values are currently associated at runtime with “runtime type” objects, or RTTs, which contain the information necessary to implement structural casts and type ch...
github.com
January 22, 2025 at 9:38 PM
Very cool post and I'm happy to see more toolchains picking up the JS string builtins. Had you experimented with the stringref proposal before the builtins proposal came along?
Do the builtins miss anything that you'd like to have faster access to?
January 22, 2025 at 9:26 PM
If you use node v23, the wasm version should already be faster than the JS version (I see 6.5 vs 7.5s) while on v22 they are about the same speed.
The speedup is caused by inlining being enabled for wasm by default now. (To see the effect, " node --no-experimental-wasm-inlining ..." disables it.)
November 17, 2024 at 10:31 PM
Could you run it multiple times from JS to see if results improve? V8 doesn't support OSR for wasm, so it might run unoptimized code only.
It might help to replace mutable globals with passing as arguments as global accesses require some indirections. wasm-opt might also find some improvements.
November 16, 2024 at 10:18 PM