9 comments

[ 3.7 ms ] story [ 36.2 ms ] thread
Raw performance (the lack of) is always a contentious point for JavaScript, especially in our post-Moore era of computing. Node.js gets around this issue through extensive of use of native libraries and modules written in C, including the V8 JS engine itself.

But as application developers, how do YOU create high performance functions? Write in C and run as a NAPI module? Write in Rust and run as a V8 wasm? Well, there is another (better and faster) way now!

The SSVM is a fully featured WebAssembly VM (https://www.secondstate.io/ssvm/) that is optimized for server-side applications.

You can write functions in Rust, compile to WebAssembly and run in SSVM, and access it as if they are JS functions in Node.js. Easy as pie. Give it a try! (https://www.secondstate.io/articles/getting-started-with-rus...)

By rewriting computationally intensive functions from JavaScript to Rust, developers could achieve 10x to 100x times performance (https://www.secondstate.io/articles/performance-rust-wasm/) gain in terms of startup and/or execution speed.

BTW, Why not just use v8? For starters, SSVM runs much faster than V8 (https://www.secondstate.io/articles/ssvm-performance/) and it also supports more server-friendly extensions than just WASI.

Any issued and feedback are welcome. Checkout the GitHub link: https://github.com/second-state/SSVM

I am highly skeptical of any claim that anything can be 10x-100x faster that JavaScript. Do you have any concrete example where a similar program coded in (decently written) JS is that slower? I work on a compiler from C++ to JavaScript & WebAssembly (Cheerp), and I have basically never saw any such a difference.
The speed differences between Python, JS, and C++/Rust are well documented. https://www.secondstate.io/articles/performance-rust-wasm/

But, of course, they are not universal and tend to have a large effect in areas where JS is rarely used — a selection bias one might say.

Do you have any single example where Rust+WebAssembly are 100x (or even 10x) faster than JavaScript?

I did got to the page you linked, but also there is no actual "proof".

We took that experts at IBM and MIT would be honest about their performance findings. :) But, it appears that actual performance numbers are of great interest to the community. We will create repeatable benchmarks and open source them. Stay tuned!
From this link: “A study done by IBM found that Rust and WebAssembly could be 15x (15,000%) faster than compiled languages, such as Scala, which is traditionally considerred a high performance language.”

This calculation is off by an order of magnitude. 15 * 100 = 1500, so a 15x increase is not 15000%.

Interesting project, but since this seems to be limited to Rust, what’s the point of WebAssembly, instead of writing JS extensions directly in Rust?
This is the same reason why people write Java but not C++ Apache extensions on the server side. It is safer and more portable to run bytecode inside containers.