pipa (枇杷) - A fast, minimal ES2023 JavaScript runtime built in Rust.
Features
- ES2023 compliant — implements the ECMAScript 2023 specification
- Async/await built-in — first-class async/await support without transpilation
- Bytecode support — compile JavaScript to
.jscbytecode files for fast loading and execution, with configurable optimization levels (-O0through-O3) - Fast — outperforms QuickJS in benchmarks
- Small — ~5.2 MB binary (with
replfeature) - Zero-dependency built-in implementations for:
- Regex/JSON/Base64/BigInt
- Unicode
fetch(HTTP client),rusttlsrequired- WebSocket
- Server-Sent Events (SSE)
No external C libraries or system dependencies for the above — everything is implemented from scratch in Rust.
Benchmarks (2026-06-05)
V8 benchmark suite comparison (higher is better):
| Benchmark | qjs | node | boa | pipa | vs qjs |
|---|---|---|---|---|---|
| Richards | 963 | 45162 | 142 | 950 | -1.3% |
| DeltaBlue | 941 | 98351 | 142 | 976 | +3.7% |
| Crypto | 1070 | 59358 | 126 | 1100 | +2.8% |
| RayTrace | 1462 | 80659 | 312 | 956 | -34.6% |
| EarleyBoyer | 2083 | 92667 | 372 | 1848 | -11.3% |
| RegExp | 329 | 13157 | 62.6 | 1018 | +209.4% |
| Splay | 2410 | 50606 | 527 | 2038 | -15.4% |
| NavierStokes | 1809 | 56244 | 295 | 2115 | +16.9% |
| SCORE (total) | 1198 | 54138 | 203 | 1295 | +8.1% |
Ranking: #1 node (54138) · #2 pipa (1295) · #3 qjs (1198) · #4 boa (203)
test262 Compatibility (2026-06-05)
Tested against tc39/test262 (excluding intl402).
| Category | Tests | Pass Rate | Notes |
|---|---|---|---|
| Core Builtins | |||
| Math | 324 | 99.7% (323/324) | |
| Boolean | 50 | 100% (50/50) | |
| parseFloat | 54 | 98.1% (53/54) | |
| parseInt | 55 | 96.4% (53/55) | |
| Number | 339 | 98.8% (335/339) | |
| Object.is | 21 | 100% (21/21) | |
| Object.defineProperty | 1131 | 98.9% (1118/1131) | |
| Object.create | 320 | 99.4% (318/320) | |
| Object.getPrototypeOf | 39 | 100% (39/39) | |
| Date | 594 | 89.2% (530/594) | |
| global | 29 | 100% (29/29) | |
| Infinity | 6 | 100% (6/6) | |
| eval | 10 | 90.0% (9/10) | |
| URI encode/decode | 173 | 45.1% (78/173) | |
| Function | 507 | 85.2% (432/507) | |
| Other Builtins | |||
| Symbol | 98 | 87.8% (86/98) | |
| JSON | 165 | 49.1% (81/165) | |
| Error | 180 | 52.8% (95/180) | |
| RegExp | 1878 | 42.3% (794/1878) | |
| String | 1222 | 77.2% (943/1222) | |
| Reflect | 153 | 21.6% (33/153) | |
| Map | 203 | 22.2% (45/203) | |
| Set | 382 | 18.8% (72/382) | |
| BigInt | 77 | 27.3% (21/77) | |
| Promise | 676 | 5.6% (38/676) | Limited async support |
| Proxy | 311 | 0% (0/311) | Not yet implemented |
Usage
# Run a script
# Run precompiled bytecode
# Compile JavaScript to bytecode
# Disassemble bytecode (debugging)
# Specify optimization level (default: -O2)
# Start REPL (requires the repl feature)
Embedding in Rust
Use pipa-js as a library to embed JavaScript in your Rust project:
[]
= "0.1.2"
Evaluate JavaScript
use ;
let mut rt = new;
let mut ctx = rt.new_context;
let val = eval.unwrap;
assert_eq!;
Read strings & values from JavaScript
use ;
let mut rt = new;
let mut ctx = rt.new_context;
eval.unwrap;
let val = eval.unwrap;
assert!;
let s = ctx.get_atom_str;
assert_eq!;
Call custom Rust functions from JavaScript
use ;
let mut rt = new;
let mut ctx = rt.new_context;
ctx.register_global_builtin;
eval.unwrap;
Async/await with event loop
use ;
let mut rt = new;
let mut ctx = rt.new_context;
eval_async.unwrap;
let val = eval.unwrap;
println!;
Requires the
fetchfeature (enabled by default).eval_asynciseval+run_event_loopin one call.
Bytecode compilation
use ;
let mut rt = new;
let mut ctx = rt.new_context;
// Compile JavaScript to register-based bytecode
let = compile_to_register_bytecode.unwrap;
// code: Vec<u8>, constants: Vec<JSValue>
assert!;
Build
# Default build (includes REPL, fetch, and process support)
# Minimal build (no REPL, no fetch, no process)
If using pipa as a library dependency and you don't need REPL/fetch/process features, add it with
default-features = false:[] = { = "0.1.1", = false }
License
MIT