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
NotificationsYou must be signed in to change notification settings

oxc-project/bench-javascript-transformer-written-in-rust

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.

Results

Codspeed

CodSpeed Badge

Codspeed measures performance by cpu instructions.

Target lowering to es2015

cal.com.tsx

oxcswc
no-drop11.3 ms (1.00x)38.1 ms (3.36x)
parallel20.6 ms (1.00x)83.1 ms (4.03x)
single-thread11.3 ms (1.00x)38.1 ms (3.37x)

typescript.js

oxcswc
no-drop80.6 ms (1.00x)337.9 ms (4.19x)
parallel130.3 ms (1.00x)725.2 ms (5.57x)
single-thread80.3 ms (1.00x)338.0 ms (4.21x)

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 26.3 mbswc 30.9 mb./files/typescript.jsoxc 137.8 mbswc 148.5 mb

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::run(source))});

no-drop

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))});

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 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

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp