💯 Performance advantages of Rust and WebAssembly

• 2 minutes to read

Senior software engineer Mohit Agrawal discussed his experience with Rust in an blog post. He compared runtime performance of Rust against other popular compiled and interpreted programming languages. Highlights from his findings:

  • Rust is 2x (200%) faster, but uses only 1% of the memory compared with Java.
  • Rust is 150x (15,000%) faster, and uses about the same amount of memory compared with Python.

A study done by IBM found that Rust and WebAssembly could be 15x (1,500%) faster than compiled languages, such as Scala, which is traditionally considerred a high performance language.

Developer and author Luca Palmieri wrote an article on Rust language's performance on Machine Learning (ML). It is shown that Rust programs outperform Python by 25x (2,500%) for similar machine learning tasks.

Maurits Kaptein from the University of Tilburg published an article comparing WebAssembly against Docker in machine learning. He ran inference operations in both Docker and WebAssembly based containers, and concluded that WebAssembly is about 5x faster and 10x smaller than Docker. He also suggested that WebAssembly improves productivity for machine learning developers due to proper sandboxing and code portability.

Docker vs WebAssembly in Machine Learning

The best way (i.e., ssafe, secure, and portable) to run Rust programs is in WebAssembly virtual machines. This study indicated that WebAssembly runtimes such as the SSVM could vastly outperform Docker when running compiled “native” programs.

Convinced? Get started with Rust functions in Node.js today! You will be up and running in 10 minutes!

RustWebAssemblyperformance
Fast, safe, portable and serverless Rust functions as services