Skip to content

Commit ec93532

Browse files
committed
add cal.com.tsx
1 parent ef0d9e3 commit ec93532

File tree

3 files changed

+30610
-12
lines changed

3 files changed

+30610
-12
lines changed

benches/parser.rs

+19-12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::path::Path;
2+
13
use criterion::{measurement::WallTime, *};
24
use rayon::prelude::*;
35

@@ -11,17 +13,21 @@ trait TheBencher {
1113

1214
fn parse(source: &str) -> Self::ParseOutput;
1315

14-
fn bench(g: &mut BenchmarkGroup<'_, WallTime>, source: &str) {
16+
fn id(filename: &str) -> String {
17+
format!("{filename}-{}", Self::ID)
18+
}
19+
20+
fn bench(g: &mut BenchmarkGroup<'_, WallTime>, filename: &str, source: &str) {
1521
let cpus = num_cpus::get_physical();
16-
let id = BenchmarkId::new(Self::ID, "single-thread");
22+
let id = BenchmarkId::new(Self::id(filename), "single-thread");
1723
g.bench_with_input(id, &source, |b, source| b.iter(|| Self::parse(source)));
1824

19-
let id = BenchmarkId::new(Self::ID, "no-drop");
25+
let id = BenchmarkId::new(Self::id(filename), "no-drop");
2026
g.bench_with_input(id, &source, |b, source| {
2127
b.iter_with_large_drop(|| Self::parse(source))
2228
});
2329

24-
let id = BenchmarkId::new(Self::ID, "parallel");
30+
let id = BenchmarkId::new(Self::id(filename), "parallel");
2531
g.bench_with_input(id, &source, |b, source| {
2632
b.iter(|| {
2733
(0..cpus).into_par_iter().for_each(|_| {
@@ -78,14 +84,15 @@ impl TheBencher for BiomeBencher {
7884
}
7985

8086
fn parser_benchmark(c: &mut Criterion) {
81-
let filename = "typescript.js";
82-
let source = std::fs::read_to_string(filename).unwrap();
83-
84-
let mut g = c.benchmark_group(filename);
85-
OxcBencher::bench(&mut g, &source);
86-
SwcBencher::bench(&mut g, &source);
87-
BiomeBencher::bench(&mut g, &source);
88-
g.finish();
87+
let filenames = ["typescript.js", "cal.com.tsx"];
88+
for filename in filenames {
89+
let source = std::fs::read_to_string(Path::new("files").join(filename)).unwrap();
90+
let mut g = c.benchmark_group(filename);
91+
OxcBencher::bench(&mut g, filename, &source);
92+
SwcBencher::bench(&mut g, filename, &source);
93+
BiomeBencher::bench(&mut g, filename, &source);
94+
g.finish();
95+
}
8996
}
9097

9198
criterion_group!(parser, parser_benchmark);

0 commit comments

Comments
 (0)