
Show HN: SSVM – Speed up your Node.js apps with Rust and WebAssembly - juntao
https://www.secondstate.io/SSVM
======
juntao
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/](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...](https://www.secondstate.io/articles/getting-started-with-rust-
function/))

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/](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/](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](https://github.com/second-state/SSVM)

~~~
carlopi
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.

~~~
juntao
The speed differences between Python, JS, and C++/Rust are well documented.
[https://www.secondstate.io/articles/performance-rust-
wasm/](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.

~~~
carlopi
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".

~~~
juntao
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!

------
jedisct1
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?

~~~
juntao
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.

