Skip to content

David200197/rust-javascript-bidirectional-benchmarks

Repository files navigation

Rust + JavaScript Bidirectional Benchmarks

This repository contains three benchmark projects to test bidirectional integration between Rust and JavaScript/TypeScript.

Structure

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

Requirements

For all projects

  • Rust: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • Node.js: v18+ recommended

For benchmark-napi-rs

npm install -g @napi-rs/cli

Quick Start

1. Benchmark napi-rs (JS → Rust)

cd benchmark-napi-rs
npm install
npm run build:native
npm run benchmark

2. Benchmark deno-core (Rust → JS)

cd benchmark-deno-core
cargo run --release

3. General comparison

cd benchmark-comparison
npm install
npm run compare

What each benchmark measures

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

Expected results

According to the blog, you should see 28x-36x improvements when using Rust for CPU-bound operations compared to pure JavaScript.

About

This repository contains three benchmark projects to test bidirectional integration between Rust and JavaScript/TypeScript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors