Skip to content

yuku-toolchain/parser-benchmark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ECMAScript Native Parser Benchmark

Benchmark ECMAScript parsers implemented in native languages.

System

Property Value
OS Linux 6.14.0-1017-azure (x64)
CPU AMD EPYC 7763 64-Core Processor
Cores 4
Memory 16 GB

Parsers

Language: Zig

A high-performance & spec-compliant JavaScript/TypeScript compiler written in Zig.

Language: Rust

A high-performance JavaScript and TypeScript parser written in Rust.

Language: Rust

An extensible Rust-based platform for compiling and bundling JavaScript and TypeScript.

Language: Zig

A JavaScript toolchain written in Zig featuring a parser, linter, formatter, printer, and vulnerability scanner.

Benchmarks

The TypeScript compiler source code bundled into a single file.

File size: 7.83 MB

TypeScript Performance

Parser Mean Min Max Peak Memory (RSS)
Yuku 77.41 ms 76.82 ms 78.89 ms 39.7 MB
Oxc 77.74 ms 77.07 ms 79.55 ms 52.8 MB
SWC 171.39 ms 169.97 ms 173.07 ms 89.7 MB
Jam 201.19 ms 200.12 ms 203.77 ms 186.1 MB

A popular 3D graphics library for the web.

File size: 1.96 MB

Three.js Performance

Parser Mean Min Max Peak Memory (RSS)
Oxc 17.23 ms 16.74 ms 17.87 ms 13.4 MB
Yuku 18.95 ms 18.59 ms 20.22 ms 10.3 MB
SWC 35.95 ms 34.59 ms 37.04 ms 22.4 MB
Jam 43.88 ms 43.40 ms 45.38 ms 39.5 MB

A popular React UI component library with enterprise-class design.

File size: 5.43 MB

Ant Design Performance

Parser Mean Min Max Peak Memory (RSS)
Yuku 60.51 ms 59.70 ms 72.04 ms 30.5 MB
Oxc 61.86 ms 61.13 ms 62.74 ms 41.0 MB
SWC 130.79 ms 129.17 ms 132.30 ms 67.4 MB
Jam Failed to parse - - -

Run Benchmarks

Prerequisites

  • Bun - JavaScript runtime and package manager
  • Rust - For building Rust-based parsers
  • Zig - For building Zig-based parsers (requires nightly/development version)
  • Hyperfine - Command-line benchmarking tool

Steps

  1. Clone the repository:
git clone https://github.com/yuku-toolchain/ecmascript-native-parser-benchmark.git
cd ecmascript-native-parser-benchmark
  1. Install dependencies:
bun install
  1. Run benchmarks:
bun bench

This will build all parsers and run benchmarks on all test files. Results are saved to the result/ directory.

Methodology

How Benchmarks Are Conducted

  1. Build Phase: All parsers are compiled with release optimizations. Source files are embedded at compile time (Zig @embedFile, Rust include_str!) to eliminate file I/O from measurements:

    • Rust parsers: cargo build --release with LTO, single codegen unit, and symbol stripping
    • Zig parsers: zig build --release=fast
  2. Benchmark Phase: Each parser is benchmarked using Hyperfine:

    • 100 warmup runs to ensure stable measurements
    • Multiple timed runs for statistical accuracy
    • Results exported to JSON for analysis
  3. Measurement: Each benchmark measures the total time to:

    • Parse the entire file into an AST (source is embedded at compile time, no file I/O)
    • Clean up allocated memory

Test Files

The benchmark uses real-world JavaScript files from popular open-source projects to ensure results reflect practical performance characteristics.

About

Benchmark ECMAScript parsers implemented in native languages.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors