11#![ allow( missing_docs) ]
22
33mod bench_complex_replace_source;
4+ mod bench_source_map;
45
56use std:: collections:: HashMap ;
67
@@ -16,6 +17,10 @@ use rspack_sources::{
1617} ;
1718
1819use bench_complex_replace_source:: benchmark_complex_replace_source;
20+ use bench_source_map:: {
21+ benchmark_parse_source_map_from_json, benchmark_source_map_clone,
22+ benchmark_stringify_source_map_to_json,
23+ } ;
1924
2025const HELLOWORLD_JS : & str = include_str ! ( concat!(
2126 env!( "CARGO_MANIFEST_DIR" ) ,
@@ -41,14 +46,6 @@ const BUNDLE_JS_MAP: &str = include_str!(concat!(
4146 env!( "CARGO_MANIFEST_DIR" ) ,
4247 "/benches/fixtures/transpile-rollup/files/bundle.js.map"
4348) ) ;
44- const ANTD_MIN_JS : & str = include_str ! ( concat!(
45- env!( "CARGO_MANIFEST_DIR" ) ,
46- "/benches/fixtures/antd-mini/antd.min.js"
47- ) ) ;
48- const ANTD_MIN_JS_MAP : & str = include_str ! ( concat!(
49- env!( "CARGO_MANIFEST_DIR" ) ,
50- "/benches/fixtures/antd-mini/antd.min.js.map"
51- ) ) ;
5249
5350fn benchmark_concat_generate_string ( b : & mut Bencher ) {
5451 let sms_minify = SourceMapSource :: new ( SourceMapSourceOptions {
@@ -225,32 +222,44 @@ fn benchmark_concat_generate_string_as_key(b: &mut Bencher) {
225222
226223fn bench_rspack_sources ( criterion : & mut Criterion ) {
227224 let mut group = criterion. benchmark_group ( "rspack_sources" ) ;
228- group. bench_function (
229- "concat_generate_base64_with_cache" ,
230- benchmark_concat_generate_base64_with_cache,
231- ) ;
232- group
233- . bench_function ( "concat_generate_base64" , benchmark_concat_generate_base64) ;
225+ // group.bench_function(
226+ // "concat_generate_base64_with_cache",
227+ // benchmark_concat_generate_base64_with_cache,
228+ // );
229+ // group
230+ // .bench_function("concat_generate_base64", benchmark_concat_generate_base64);
234231
235- group. bench_function (
236- "concat_generate_string_with_cache" ,
237- benchmark_concat_generate_string_with_cache,
238- ) ;
239- group
240- . bench_function ( "concat_generate_string" , benchmark_concat_generate_string) ;
232+ // group.bench_function(
233+ // "concat_generate_string_with_cache",
234+ // benchmark_concat_generate_string_with_cache,
235+ // );
236+ // group
237+ // .bench_function("concat_generate_string", benchmark_concat_generate_string);
238+
239+ // group.bench_function(
240+ // "concat_generate_string_with_cache_as_key",
241+ // benchmark_concat_generate_string_with_cache_as_key,
242+ // );
243+ // group.bench_function(
244+ // "concat_generate_string_as_key",
245+ // benchmark_concat_generate_string_as_key,
246+ // );
247+
248+ // group
249+ // .bench_function("complex_replace_source", benchmark_complex_replace_source);
241250
242251 group. bench_function (
243- "concat_generate_string_with_cache_as_key " ,
244- benchmark_concat_generate_string_with_cache_as_key ,
252+ "parse_source_map_from_json " ,
253+ benchmark_parse_source_map_from_json ,
245254 ) ;
255+
256+ group. bench_function ( "source_map_clone" , benchmark_source_map_clone) ;
257+
246258 group. bench_function (
247- "concat_generate_string_as_key " ,
248- benchmark_concat_generate_string_as_key ,
259+ "stringify_source_map_to_json " ,
260+ benchmark_stringify_source_map_to_json ,
249261 ) ;
250262
251- group
252- . bench_function ( "complex_replace_source" , benchmark_complex_replace_source) ;
253-
254263 group. finish ( ) ;
255264}
256265
0 commit comments