This repository contains three benchmark projects to test bidirectional integration between Rust and JavaScript/TypeScript.
rust-js-benchmarks/
├── benchmark-napi-rs/ # JS → Rust (accelerate Node.js with Rust)
├── benchmark-deno-core/ # Rust → JS (add flexibility to Rust with JS/TS)
└── benchmark-comparison/ # General comparison
- Rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh - Node.js: v18+ recommended
npm install -g @napi-rs/clicd benchmark-napi-rs
npm install
npm run build:native
npm run benchmarkcd benchmark-deno-core
cargo run --releasecd benchmark-comparison
npm install
npm run compare| Project | Direction | Use case | Metrics |
|---|---|---|---|
| napi-rs | JS → Rust | Heavy financial calculations | ops/sec, latency |
| deno-core | Rust → JS | Dynamic plugins | startup time, throughput |
| comparison | Both | Side-by-side comparison | comparative table |
According to the blog, you should see 28x-36x improvements when using Rust for CPU-bound operations compared to pure JavaScript.