Pipa-js: A fast, minimal ES2023 JavaScript runtime built in Rust
⚓ Rust 📅 2026-05-20 👤 surdeus 👁️ 1I built pipa-js over the past 3 weeks: a register-based VM that runs ES2023 JavaScript, implemented entirely in Rust with no runtime, no C dependencies. The final binary is ~5.2 MB, scores 1256 on the V8 benchmark suite (beating QuickJS at 1219), and includes zero-external-dependency implementations of regex, JSON, fetch, WebSocket, SSE, BigInt, and Base64.
Rust made this feasible in ways that C or C++ couldn't. The NaN-boxing value system (src/value.rs) uses u64 bit patterns with safe const generics — every JSValue is a #[derive(Clone, Copy)] u64 wrapper, no heap allocation for primitive values.
The shape system (src/object/shape.rs) relies on NonNull<Shape> for parent pointers and UnsafeCell<FxHashMap> for lazy property map building, all enforced by Rust's ownership model — no manual refcounting, no use-after-free in the property transition chain.
The register VM itself is ~8700 lines of match on instruction opcodes, with u16 register indices, variable-length instructions (1/3/5/7/9/11 bytes), and fused operations like EqJumpIf that combine comparison and branch into one opcode.
1 post - 1 participant
🏷️ Rust_feed