Endive 1.3.0: SIMD in the Compilers, a Hardened WASI, and Method Splitting
Four weeks ago we released 1.2.0, and four weeks from now it is Christmas.
Endive 1.3.0 lands in between, most likely our last release before the holidays, and for a single
month of work there is a lot in it. The bytecode compilers now run SIMD, so a module that uses v128
no longer needs the interpreter. WASI is hardened, tested on the host file systems of Linux, macOS and
Windows, and passes the whole Zig standard library test suite. And functions too large for the JVM to
JIT-compile can be split into methods that it will.
SIMD in the Compilers
Last month SIMD landed in the interpreter, and we promised the compilers were next. Here they are: the runtime and build-time compilers support the whole proposal and pass its specification tests.
This one took a lot of benchmarking. We tried four ways to compile v128, from the Vector API to plain
Java, and raced them on libsodium, OpenSSL and a handful of small kernels, each built with and without
SIMD, before settling on one. The Vector API won some races and lost others by 10×, depending on JIT
decisions that change from one JDK to the next. Plain Java won on predictability: generated classes
still run on Java 11, with no flags and no extra dependencies.
The same payloads also showed that SIMD is not a free win. Built with SIMD, OpenSSL's ChaCha20 runs 2.5× faster, while a floating-point kernel runs 2× slower. Build your module both ways and measure: the documentation explains when each one wins.
redline is now the only engine without SIMD, and closing that gap is the last step of
#181.
A Hardened WASI
More than half of this month's pull requests went into WASI, and many began with someone running a real program on a real directory and telling us what broke. The most fun came from ooRexx, heir to a scripting language born at IBM in 1979, which now runs on the JVM through Endive and passes its whole official test suite.
If your guests use host directories, this is a release to pick up. For untrusted guests, a virtual file system such as ZeroFs is still our recommendation: see Security Best Practices.
It is also tested far more widely now:
- Host file systems. The WASI testsuite now runs on real directories on Linux, macOS and Windows, not just in memory, so platform differences show up in our CI instead of in your programs.
- Zig. The Zig standard library tests, more than 3,200 of them, now pass with the stock test runner. No more skip list.
- Real programs. SQLite's
speedtest1and CPython's file I/O match Wasmtime, and SQLite point reads went from 168k to 198k per second on macOS.
When you upgrade, note that some error codes changed to match POSIX and Wasmtime.
Method Splitting
HotSpot does not JIT-compile very large methods, and Endive compiles each Wasm function to one method. So the biggest functions in a module, often the main loop of a language runtime, stayed interpreted no matter how hot they ran.
Method splitting breaks them into methods the JIT accepts, and it brings the biggest numbers of this release: on the Richards benchmark from Are We Fast Yet, CPython runs about 40× faster, QuickJS 6× and Lua 5×. It is also a gift from the community: it started as a pull request answering a feature request.
It is experimental and off by default.
Turn it on with withMethodSplitting(true), --method-splitting on the CLI, or in the Maven plugin:
<configuration>
<methodSplitting>true</methodSplitting>
</configuration>
We already depend on it: every module Endive compiles for its own build has it on. The design notes explain how it works and where its limits are.
Everything Else
Indirect calls in large modules got faster, and a round of correctness and compliance fixes landed, one of them a WasmGC subtyping bug that Scala.js caught for us. Hello worlds from Scala.js and Dart now run in our CI, interpreted and compiled. The release notes list every change.
On the Horizon
Components. A month ago the Component Model work was "taking shape". Now it has a name and a first
release: Typewire 0.0.1 is on Maven Central, with
wasi:sockets added and the first steps towards wasi:http. It is early and the API may still change,
so try it and tell us what you think: your feedback will shape what comes next.
Java 11. #250 is still open, and every project that has answered runs Java 17 or later. If you need Java 11, that is the place to say so.
Thanks
A month this full does not come from us alone. Several fixes started as an issue with a reproducer, from people running interpreters, databases and language runtimes on Endive across Windows, macOS and Linux. Others arrived as pull requests with tests and measurements. Thank you to everyone who shipped code, filed an issue, tested a snapshot or reviewed the docs. Using Endive? Add your project to the adopters list.
That was one month of Endive. If it turns out to be our last release of the year: happy holidays, and come tell us what you are building. Join the conversation on Zulip.