Skip to content

Commit 65764fd

Browse files
committed
ci(benchmarks/formatter): Update formatter bench with sort-imports (#15584)
> I think we don't need to add another benchmark for the sort import feature; enabling it in > formatter.rs is enough. Any of the current benchmark files contains many import statements. It seems there was no need to create a separate file after all. My intention was to confirm that the benchmark for the formatter alone consistently produced better results than the benchmark with sorting enabled. To verify this, shouldn't the benchmarks be separated?
1 parent 99823ad commit 65764fd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tasks/benchmark/benches/formatter.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use oxc_allocator::Allocator;
22
use oxc_benchmark::{BenchmarkId, Criterion, criterion_group, criterion_main};
3-
use oxc_formatter::{FormatOptions, Formatter, get_parse_options};
3+
use oxc_formatter::{FormatOptions, Formatter, SortImports, get_parse_options};
44
use oxc_parser::Parser;
55
use oxc_tasks_common::TestFiles;
66

@@ -19,7 +19,10 @@ fn bench_formatter(criterion: &mut Criterion) {
1919
.with_options(get_parse_options())
2020
.parse()
2121
.program;
22-
let format_options = FormatOptions::default();
22+
let format_options = FormatOptions {
23+
experimental_sort_imports: Some(SortImports::default()),
24+
..Default::default()
25+
};
2326
runner.run(|| {
2427
Formatter::new(&allocator, format_options).build(&program);
2528
});

0 commit comments

Comments
 (0)