Skip to content

Commit

Permalink
perf: introduce simple and complex rope
Browse files Browse the repository at this point in the history
  • Loading branch information
h-a-n-a committed Dec 9, 2024
1 parent 44878c8 commit 9bc14d3
Show file tree
Hide file tree
Showing 2 changed files with 316 additions and 193 deletions.
60 changes: 31 additions & 29 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,15 @@ fn benchmark_concat_generate_string(b: &mut Bencher) {

let concat = ConcatSource::new([sms_minify, sms_rollup]);

b.iter(|| {
concat
.map(&MapOptions::default())
.unwrap()
.to_json()
.unwrap();
})
dbg!(concat.rope());

// b.iter(|| {
// concat
// .map(&MapOptions::default())
// .unwrap()
// .to_json()
// .unwrap();
// })
}

fn benchmark_concat_generate_string_with_cache(b: &mut Bencher) {
Expand Down Expand Up @@ -254,30 +256,30 @@ fn benchmark_concat_generate_string_as_key(b: &mut Bencher) {

fn bench_rspack_sources(criterion: &mut Criterion) {
let mut group = criterion.benchmark_group("rspack_sources");
group.bench_function(
"concat_generate_base64_with_cache",
benchmark_concat_generate_base64_with_cache,
);
group
.bench_function("concat_generate_base64", benchmark_concat_generate_base64);
group.bench_function(
"concat_generate_string_with_cache",
benchmark_concat_generate_string_with_cache,
);
// group.bench_function(
// "concat_generate_base64_with_cache",
// benchmark_concat_generate_base64_with_cache,
// );
// group
// .bench_function("concat_generate_base64", benchmark_concat_generate_base64);
// group.bench_function(
// "concat_generate_string_with_cache",
// benchmark_concat_generate_string_with_cache,
// );
group
.bench_function("concat_generate_string", benchmark_concat_generate_string);
group.bench_function(
"replace_large_minified_source",
benchmark_replace_large_minified_source,
);
group.bench_function(
"concat_generate_string_with_cache_as_key",
benchmark_concat_generate_string_with_cache_as_key,
);
group.bench_function(
"concat_generate_string_as_key",
benchmark_concat_generate_string_as_key,
);
// group.bench_function(
// "replace_large_minified_source",
// benchmark_replace_large_minified_source,
// );
// group.bench_function(
// "concat_generate_string_with_cache_as_key",
// benchmark_concat_generate_string_with_cache_as_key,
// );
// group.bench_function(
// "concat_generate_string_as_key",
// benchmark_concat_generate_string_as_key,
// );
group.finish();
}

Expand Down
Loading

0 comments on commit 9bc14d3

Please sign in to comment.