backgroundradial

Introducing Wasmer 5.0

Today we are presenting the latest stable version of Wasmer: v5.0 with tons of improvements and a better performance overall

syrusakbary avatar
syrusakbary

Founder & CEO

runtime

October 29, 2024

arrowBack to articles
Post cover image

We are thrilled to announce the release of Wasmer 5.0, the latest milestone in our journey to make WebAssembly the greatest tool for executing software anywhere.

This announcement comes packed with awesome new features:

  • Experimental support for more backends: V8, Wasmi and WAMR
  • iOS support
  • Leaner codebase
  • Enhanced Performance
  • Upgraded Compilers (now using LLVM 18 and latest Cranelift)

Do you like the new features? Don't wait and give us a ⭐️ on Github! github.com/wasmerio/wasmer


Key Highlights

New experimental backends

Some time ago we asked in Wasmer’s Community which backend would you like to see Wasmer support next.

The responses were overwhelming: V8 (the engine behind Google’s Chrome Javascript runtime) was the most voted backend, with 56% of the votes. We learned from the poll results that interpreter support was also a desire from the community.

Wasmer Backend Community Poll

Well, the day has come. We have added support for more backends: V8, Wasmi and also WAMR. All of them are integrated via the Wasm-C-API , as they all share this external interface in common.

Thanks to the latest additions, now any interpreter or runtime that supports the Wasm-C-API spec can be easily integrated into Wasmer.

We expect that the V8 integration will allow bringing a great debugging experience via the V8 debugger and Chrome Devtools. But not only that, having V8 as a backend also means supporting WebAssembly Exceptions and Garbage Collection under the hood. Stay tuned for more news on this front soon.

As of today, Wasmer supports the following backends, so you can run WebAssembly using the Wasmer API in the following contexts:

  • Natively (via Wasmer native compilers)
    • Singlepass (singlepass feature): ideal for blockchains
    • Cranelift (cranelift feature): ideal for development
    • LLVM (llvm feature): ideal for production workloads
  • Browser: the browser’s underlying Wasm engine (web feature) See https://github.com/wasmerio/wasmer-js for more info.
  • JavascriptCore: JavascriptCore engine from Apple. Ideal if you want to use a lightweight and incredibly performant runtime in macOS (jsc feature)
  • V8: Google’s JS V8 engine, ideal if you want to use Wasmer in iOS or Android (v8 feature)
  • Wasmi: one of the most optimal Rust WebAssembly interpreters. Ideal if you want to use Wasm in nostd environments or blockchains with a pure Rust codebase (wasmi feature)
  • WAMR: (wamr feature) ideal for iOS

So… how fast are each of the backends?

Benchmarking the backends

We have run an extensive set of benchmarks based on Wasmi’s great benchmarking blogpost to see how each of these backends behave for diverse scenarios. Here are our findings!

Wasmer 5 Argon 2 benchmark

Wasmer 5 Bulk Operations benchmark

Wasmer 5 Counter benchmark

Wasmer 5 Primes benchmark

Wasmer 5 Fibonacci (iterative) benchmark

Wasmer 5 Fibonacci (recursive) benchmark

Wasmer 5 Matmul benchmark

Full iOS Support via WAMR, Wasmi and V8 bindings

For the first time, Wasmer brings WebAssembly to iOS devices through a new interpreted mode.

Wasmer 5 Running on iOS

About a year ago we added support for JavacriptCore in Wasmer, with the hope that it would enable a fast runtime on iOS (since the JIT would be unrestricted). Unfortunately, iOS capped the ability of using WebAssembly via JavascriptCore (since iOS 14).

Leveraging the capabilities of V8, Wasmi and WebAssembly Micro Runtime (WAMR), developers can now run WebAssembly modules seamlessly on iOS thanks to Wasmer 5.0. No changes needed on their codebase. This opens up a world of possibilities for mobile development, enabling high-performance applications on Apple's ecosystem.

We want to thank Holochain as this work wouldn’t be possible without our partnership.

Leaner codebase

For the release of Wasmer 5.0 we have put an special emphasis on making Wasmer codebase as lean as possible, so we can develop new features even faster.

As part of this effort, we realized that:

  • Emscripten bindings have been mostly unused in the last two years, mainly influenced by these two factors:
    • Emscripten emits code using WASI systemcalls under the hood when possible, removing the need for having special bindings for Emscripten
    • WASIX helps to bridge the gap of the WASI systemcalls that are not supported (threads, longjmp/setjmp, fork, …)
  • Some of the dependencies Wasmer used have been long unmaintained, or duplicated by newer and safer crates

Because of that, we decided to drop support for Emscripten and trimmed up the dependencies resulting in a net result of 20k lines of code deleted in the Wasmer codebase.

Enhanced Performance

Module deserialization now is up to 50% faster (that is, when you call Module::deserialize or when you run a module via wasmer run).

Performance is at the heart of Wasmer, and version 5.0 takes it to the next level. These improvements are leveraging essential updates on rkyv: the zero-copy deserialization library that we use to deserialize our Modules.

Here’s a benchmark of all the backends using latest Wasmer vs the latest release.

Wasmer 5 Time to deserialize a WebAssembly module

Upgraded Compilers: Cranelift and LLVM 18

The latest Cranelift integration results in significant runtime speed improvements, making your WebAssembly modules execute faster than ever before.

Wasmer 5.0 now includes the most recent version of LLVM (18), ensuring that developers have access to the latest optimizations from the toolchain. The LLVM upgrade enhances compatibility and performance, providing a robust foundation for compiling and running complex WebAssembly modules.

On top of that, Wasmer 5.0 also ships with experimental LoongAarch64 support.

We have also benchmarked coremark with the latest version of the compilers to see how they compare: Wasmer 5 Coremark results

LLVM and Cranelift are about 8% faster in Wasmer v5.0 compared to v4.4.0

Getting Started with Wasmer 5.0

Ready to dive in? Here's how you can start exploring the new features:

  • Download Wasmer 5.0: Get the latest version from our official website.
  • Update Your Projects: Upgrade your existing Wasmer projects to leverage the new capabilities.
  • Explore the Documentation: Visit our updated docs for detailed guides and tutorials.
  • Join the Community: Connect with other developers on our Discord server and share your experiences.

Looking Ahead

Wasmer 5.0 is a significant step forward in our mission to empower developers thanks of the exciting possibilities that WebAssembly brings to the table. With iOS support, our pluggable backend architecture and the enhanced performance, the possibilities are now endless. We can't wait to see what you'll build next with Wasmer.


Stay Updated

Thank you everyone for being part of the Wasmer journey!

About the Author

Syrus Akbary is an enterpreneur and programmer. Specifically known for his contributions to the field of WebAssembly. He is the Founder and CEO of Wasmer, an innovative company that focuses on creating developer tools and infrastructure for running Wasm

 avatar

Founder & CEO

Read more
Post cover image

wasixengineeringepollruntime

Boosting Performance: Integration of epoll syscall in WASIX

RudraAugust 8, 2023

engineeringruntime

Announcing Wasmer 3.0

November 23, 2022

engineeringruntimewasmer 2.1

Wasmer-JS: A New Hope

December 7, 2021

engineeringruntimewasmer runtime

Wasmer 4.1

July 17, 2023