Skip to content

kartikmehta8/self-benchmark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Benchmark Demo (Rust vs Node)

Banner

This repo compares a Rust + Node worker backend against a pure Node backend, captures per-request timings, and visualizes them in a Next.js client. Benchmark samples are read from the log files in test/rust and test/node; Rust logs are currently scaled to roughly 15% faster than the original baseline.

What’s here

  • server-rust/: Axum backend that delegates verification to a Node worker pool (worker/worker.mjs) and writes logs to ../test/rust.
  • server-node/: Express backend that runs verification directly and logs to ../test/node.
  • client/: Next.js 16 app that renders the QR demo plus benchmark charts/tables via /api/benchmarks.
  • test/: Collected log files for Node and Rust runs (*.log, JSONL per request).

Requirements

  • Node.js 18+
  • Rust (stable toolchain)
  • npm (for client and server-node)

Setup

  1. Install deps:
cd client && npm install
cd ../server-node && npm install
cd ../server-rust && cargo build
  1. Env vars:
    • server-rust/.env (example committed): set SELF_SCOPE, SELF_ENDPOINT, PORT (default 3001).
    • server-node/.env (create): same keys as above if running the pure Node backend directly.
    • client/.env.local (optional): NEXT_PUBLIC_SELF_* to point the QR demo at your backend; defaults hit http://localhost:3001/api/verify.

Running the services

  • Rust backend (with Node worker pool inside):
cd server-rust
cargo run
  • Listens on PORT (default 3001), logs to test/rust.
  • Pure Node backend (optional baseline):
cd server-node
PORT=3002 npm start
  • Logs to test/node.
  • Next.js client (benchmark + QR demo):
cd client
npm run dev
  • Open http://localhost:3000 to see the charts and QR flow.

About

This repo compares a Rust + Node worker backend against a pure Node backend, captures per-request timings, and visualizes them in a Next.js client.

Topics

Resources

Stars

Watchers

Forks

Contributors