File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ use benchmark_repetitive_react_components::{
3030 benchmark_repetitive_react_components_source,
3131} ;
3232
33+ use crate :: benchmark_repetitive_react_components:: benchmark_repetitive_react_components_map_with_warmed_pool;
34+
3335const HELLOWORLD_JS : & str = include_str ! ( concat!(
3436 env!( "CARGO_MANIFEST_DIR" ) ,
3537 "/benches/fixtures/transpile-minify/files/helloworld.js"
@@ -181,6 +183,11 @@ fn bench_rspack_sources(criterion: &mut Criterion) {
181183 benchmark_repetitive_react_components_map,
182184 ) ;
183185
186+ group. bench_function (
187+ "repetitive_react_components_map_with_warmed_pool" ,
188+ benchmark_repetitive_react_components_map_with_warmed_pool,
189+ ) ;
190+
184191 group. bench_function (
185192 "repetitive_react_components_source" ,
186193 benchmark_repetitive_react_components_source,
Original file line number Diff line number Diff line change @@ -3509,6 +3509,20 @@ pub fn benchmark_repetitive_react_components_map(b: &mut Bencher) {
35093509 } ) ;
35103510}
35113511
3512+ pub fn benchmark_repetitive_react_components_map_with_warmed_pool (
3513+ b : & mut Bencher ,
3514+ ) {
3515+ let source = REPETITIVE_1K_REACT_COMPONENTS_SOURCE . clone ( ) ;
3516+
3517+ let object_pool = ObjectPool :: default ( ) ;
3518+ // Warm up the object pool to avoid measuring initialization overhead
3519+ black_box ( source. map ( & object_pool, & MapOptions :: default ( ) ) ) ;
3520+
3521+ b. iter ( || {
3522+ black_box ( source. map ( & object_pool, & MapOptions :: default ( ) ) ) ;
3523+ } ) ;
3524+ }
3525+
35123526pub fn benchmark_repetitive_react_components_source ( b : & mut Bencher ) {
35133527 let source = REPETITIVE_1K_REACT_COMPONENTS_SOURCE . clone ( ) ;
35143528
You can’t perform that action at this time.
0 commit comments