Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

oxc is 3x faster than swc, 5x faster than biome —

NotificationsYou must be signed in to change notification settings

CodeEditorLand/BenchJavaScriptParserWrittenInRust

 
 

Repository files navigation

The purpose of this benchmark is for people who wants to evaluate and compare the performance characteristics of these parsers.

Summary

Oxc's parser is at least 3x faster than swc and 5x faster than Biome.

Please note that it is not an apple to apple comparison with Biome.Biome's parserproduces a CST instead of an AST,which requires a lot more work.

CPU

Codspeed Measurement

CodSpeed Badge

Codspeed measures performance by cpu instructions.

Mac i7 6 cores

Mac mini M2 8 cores

cal.com.tsx

oxcswcbiome
no-drop4.0 ms (1.00x)14.0 ms (3.50x)18.7 ms (4.68x)
parallel7.4 ms (1.00x)26.4 ms (3.56x)38.7 ms (5.21x)
single-thread4.0 ms (1.00x)14.9 ms (3.73x)20.1 ms (5.04x)

typescript.js

oxcswcbiome
no-drop30.3 ms (1.00x)100.3 ms (3.31x)149.7 ms (4.94x)
parallel52.0 ms (1.00x)164.5 ms (3.17x)296.5 ms (5.71x)
single-thread29.8 ms (1.00x)108.0 ms (3.62x)159.5 ms (5.34x)

MacBook Pro M3 Max

cal.com.tsx

oxcswcbiome
no-drop3.4 ms (1.00x)13.4 ms (3.99x)16.7 ms (4.97x)
parallel5.8 ms (1.00x)23.8 ms (4.14x)30.1 ms (5.23x)
single-thread3.4 ms (1.00x)14.4 ms (4.28x)18.3 ms (5.42x)

typescript.js

oxcswcbiome
no-drop26.3 ms (1.00x)84.1 ms (3.20x)130.1 ms (4.94x)
parallel36.1 ms (1.00x)126.3 ms (3.50x)225.9 ms (6.26x)
single-thread26.4 ms (1.00x)91.0 ms (3.45x)139.3 ms (5.28x)

Run benchmark locally

Run the following command on your machine for replication.

cargo bench

Generate the table

pnpm ipnpm run table

Maximum Resident Set Size

./memory.sh./files/cal.com.tsxoxc   11.5 mb (1.00x)swc   16.6 mb (1.44x)biome 22.5 mb (1.95x)./files/typescript.jsoxc    68.8 mb (1.00x)swc    92.0 mb (1.34x)biome 117.4 mb (1.70x)

Setup

  • Usesmimalloc as the global allocator
  • Uses the following release profile
[profile.release]opt-level     =3lto           ="fat"codegen-units =1strip         ="symbols"debug         =falsepanic         ="abort"

single-thread

This is the standard benchmark run in a single thread.

group.bench_with_input(id,&source, |b, source|{    b.iter(||Self::parse(source))});

no-drop

This uses theiter_with_large_drop function, which does not take AST drop time into account.Notice there is only a 0.3ms difference for oxc, but 7ms difference for swc.

AST drop time can become a bottleneck in applications such as as bundler,where there are a few thousands of files need to be parsed.

group.bench_with_input(id,&source, |b, source|{    b.iter_with_large_drop(||Self::parse(source))});

parallel

This benchmark uses the total number of physical cores as the total number of files to parse per bench iteration. For example it parses 6 files in parallel on my Mac i7 6 cores.

This can indicate the existence of global resource contention.

let cpus = num_cpus::get_physical();group.bench_with_input(id,&source, |b, source|{    b.iter(||{(0..cpus).into_par_iter().for_each(|_|{Self::parse(source);});})});

About

oxc is 3x faster than swc, 5x faster than biome —

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript88.5%
  • TypeScript11.4%
  • Other0.1%

[8]ページ先頭

©2009-2025 Movatter.jp