Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1
oxc-project/bench-javascript-transformer-written-in-rust
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A transformer is also known as a transpiler, similar to Babel transform.
The purpose of this benchmark is for people who wants to evaluate and compare the performance characteristics of the two transformer.
The benchmark measures the whole parse -> transform -> codegen pipeline as a real-word scenario.
The numbers indicate that Oxc is at least 3 times faster than Swc.
Codspeed measures performance by cpu instructions.
oxc | swc | |
---|---|---|
no-drop | 11.3 ms (1.00x) | 38.1 ms (3.36x) |
parallel | 20.6 ms (1.00x) | 83.1 ms (4.03x) |
single-thread | 11.3 ms (1.00x) | 38.1 ms (3.37x) |
oxc | swc | |
---|---|---|
no-drop | 80.6 ms (1.00x) | 337.9 ms (4.19x) |
parallel | 130.3 ms (1.00x) | 725.2 ms (5.57x) |
single-thread | 80.3 ms (1.00x) | 338.0 ms (4.21x) |
Run the following command on your machine for replication.
cargo bench
Generate the table
pnpm ipnpm run table
./memory.sh./files/cal.com.tsxoxc 26.3 mbswc 30.9 mb./files/typescript.jsoxc 137.8 mbswc 148.5 mb
- Uses
mimalloc
as the global allocator - Uses the following release profile
[profile.release]opt-level =3lto ="fat"codegen-units =1strip ="symbols"debug =falsepanic ="abort"
This is the standard benchmark run in a single thread.
group.bench_with_input(id,&source, |b, source|{ b.iter(||Self::run(source))});
This uses theiter_with_large_drop
function, which does not take AST drop time into account.
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::run(source))});
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 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::run(source);});})});
About
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.