File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,9 @@ use rspack_sources::{
1717} ;
1818
1919use bench_complex_replace_source:: benchmark_complex_replace_source;
20- use bench_source_map:: benchmark_parse_source_map_from_json;
20+ use bench_source_map:: {
21+ benchmark_parse_source_map_from_json, benchmark_source_map_clone,
22+ } ;
2123
2224const HELLOWORLD_JS : & str = include_str ! ( concat!(
2325 env!( "CARGO_MANIFEST_DIR" ) ,
@@ -246,10 +248,12 @@ fn bench_rspack_sources(criterion: &mut Criterion) {
246248 . bench_function ( "complex_replace_source" , benchmark_complex_replace_source) ;
247249
248250 group. bench_function (
249- "benchmark_parse_source_map_from_json " ,
251+ "parse_source_map_from_json " ,
250252 benchmark_parse_source_map_from_json,
251253 ) ;
252254
255+ group. bench_function ( "source_map_clone" , benchmark_source_map_clone) ;
256+
253257 group. finish ( ) ;
254258}
255259
Original file line number Diff line number Diff line change @@ -18,3 +18,10 @@ pub fn benchmark_parse_source_map_from_json(b: &mut Bencher) {
1818 let _ = black_box ( || SourceMap :: from_json ( ANTD_MIN_JS_MAP ) . unwrap ( ) ) ;
1919 } )
2020}
21+
22+ pub fn benchmark_source_map_clone ( b : & mut Bencher ) {
23+ let source = SourceMap :: from_json ( ANTD_MIN_JS_MAP ) . unwrap ( ) ;
24+ b. iter ( || {
25+ let _ = black_box ( || source. clone ( ) ) ;
26+ } )
27+ }
You can’t perform that action at this time.
0 commit comments