技術的な事実と測定上の注意事項は、翻訳間のずれを防ぐため英語を正本として管理しています。
Compile JavaScript/TypeScript to a Binary
Perry turns supported JavaScript/
$ perry compile main.ts ✓ Example executable written: main (size varies) $ ./main Hello, World!
Three different meanings of “compile”
- 01
Transpile
TypeScript compilers and bundlers can emit JavaScript. That output still runs in Node.js, Bun, Deno, or a browser.
- 02
Bundle a runtime
Bun, Deno, and Node SEA can produce one file by packaging the program with their runtime or executable machinery. Consult each tool's documentation for its exact format.
- 03
Ahead-of-time compile
Perry parses with SWC and uses LLVM to emit machine code for supported behavior, then links the Perry runtime and GC.
What is actually in a Perry binary?
The file contains compiled application code plus the Perry runtime pieces required by the program. It is therefore accurate to say that no external JavaScript runtime installation is needed; it is not accurate to say that Perry has no runtime at all. Native builds use a garbage collector, object and string support, async machinery, and other linked helpers. The optional V8 fallback adds an embedded JavaScript engine when enabled.
The public examples show a hello-world binary around ~330 KB and the Mango application around ~7 MB. Those are examples, not a promised range. Output size changes with the target, imports, build profile, standard-library surface, debug information, and optional V8 fallback.
Compatibility and targets
Perry documents 11 targets plus a separate HarmonyOS preview. Web and WASM are aliases for one backend. Platform SDKs, host tools, signing credentials, and UI/API depth differ by target, so cross-compilation is not an unconditional “build any target from any host” promise.
Perry reports ~97% of its tracked Node suite across 53 modules and roughly ~50 package/API implementations. That does not mean every npm package or JavaScript feature works. Run perry check and test the real application against the published limitations.
Primary sources
Published measurements
Current public results include wins, mixed results, and losses. Treat microbenchmarks as workload-specific measurements, not a universal speed claim.
| Metric | Perry | Node.js | Bun |
|---|---|---|---|
| Binary Size | ~330 KB hello world; ~7 MB Mango | Application plus an installed Node.js runtime | Standalone executable embeds the Bun runtime |
| Startup Time | ~3.2 ms* | Engine boot and warmup; workload-dependent | Engine boot and warmup; workload-dependent |
| Runtime Dependencies | Statically linked Perry runtime + GC | External Node.js runtime | Embedded Bun / JavaScriptCore runtime |
| Memory Overhead | Workload-dependent | Workload-dependent | Workload-dependent |
* Measured runtime-only macOS hello world on an Apple M-series host (5.0 → 3.2 ms after removing unused dynamic-library links). Application startup varies.
Full public suite: wins and losses
Lower wall-clock median is better. Five complete process samples; correctness checks passed. Benchmark names and descriptions remain English technical identifiers.
| Benchmark | Perry | Node.js | Bun | Result |
|---|---|---|---|---|
| factorialModular accumulation | 93 ms | 95 ms | 95 ms | Even with both |
| method callsClass method dispatch | 35 ms | 11 ms | 8 ms | Loss vs both |
| closureClosure creation and invocation | 47 ms | 49 ms | 49 ms | Even with both |
| binary treesTree allocation and traversal | 13 ms | 6 ms | 6 ms | Loss vs both |
| string concatString append loop | 6 ms | 31 ms | 5 ms | Mixed |
| prime sieveSieve of Eratosthenes | 6 ms | 5 ms | 5 ms | Loss vs both |
| mandelbrotComplex-number iteration | 25 ms | 24 ms | 29 ms | Mixed |
| matrix multiplyMatrix multiplication | 19 ms | 33 ms | 33 ms | Win vs both |
| JSON roundtripParse and stringify ~1 MB JSON | 144 ms | 392 ms | 219 ms | Win vs both |
Validate your application
Install Perry, run its compatibility check, and measure the actual output you plan to ship.