Skip to content

mbbill/Silverfir-nano

Repository files navigation

Silverfir-nano

A 277 KB no_std WebAssembly JIT engine that goes head-to-head with V8 and Wasmtime.

On Apple M4, Silverfir-nano beats Wasmtime's Cranelift on multiple benchmarks and goes head-to-head with V8 TurboFan, while staying ultra-compact and no_std-compatible.

Performance

All benchmarks on Apple M4 (MacBook Air, macOS 26). Silverfir vs Wasmtime Cranelift (optimizing JIT) and V8 TurboFan (Node.js 25.4).

Integer / Control Flow

Integer benchmarks

Lua Interpreter

Lua benchmarks

Floating Point

FP benchmarks

Memory Bound (STREAM)

Memory benchmarks

Summary

See the charts above and full benchmark results for numbers.

Highlights

  • Competes with optimizing JITs — beats Cranelift on CoreMark and Lua benchmarks, beats V8 on STREAM and floating-point workloads
  • Ultra-compact — the minimal no_std JIT binary is just 277 KB stripped, with zero runtime dependencies
  • Full WebAssembly 2.0 — multi-value, reference types, bulk memory, multiple tables
  • no_std — core library requires only alloc; runs on embedded and bare-metal

Architecture

Silverfir-nano uses a micro-JIT that translates WebAssembly to native ARM64 machine code at function granularity. Key techniques:

  • Native code generation — direct ARM64 emission, no interpreter dispatch overhead
  • Register allocation — maps WebAssembly locals and stack to hardware registers
  • Inline operations — arithmetic, comparisons, and memory access compiled to native instructions

Interpreter-Only Mode

If you need a pure interpreter without JIT (e.g., for platforms without executable memory), check out the interp branch:

git checkout interp

This branch includes the fast interpreter with instruction fusion and register caching, but no native code generation.

Building

# Default build (micro-JIT)
cargo build --release

# Run a WASI program
./target/release/sf-nano-cli program.wasm [args...]

# Run benchmarks
python3 benchmarks/wasi/run_tests.py

# Run benchmarks in V8 (Node.js)
node benchmarks/wasi/run_v8.mjs

# Minimal no_std build (277 KB, no WASI, JIT only)
# Must be built standalone (excluded from workspace due to no_std)
cd sf-nano-cli-minimal && cargo run --release

WebAssembly 2.0 Compatibility

Tested against the official WebAssembly spec testsuite:

  • Multi-value returns
  • Reference types (funcref, externref)
  • Bulk memory operations
  • Multiple tables
  • Mutable globals import/export

License

MIT / Apache-2.0

About

A 277 KB no_std WebAssembly JIT engine that goes head-to-head with V8 and Wasmtime.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors