@@ -94,6 +94,7 @@ fn generate_benchmark_chart(
9494 base_hue : f64 ,
9595 x_offset : f64 ,
9696 y_offset : f64 ,
97+ global_max_time : u64 ,
9798) -> Group {
9899 let mut group = Group :: new ( ) ;
99100 let chart_id = & benchmark. name ;
@@ -103,13 +104,8 @@ fn generate_benchmark_chart(
103104 return group;
104105 }
105106
106- // Find bounds - max_time for y-axis scaling, max_frame for x-axis
107- let max_time = runs
108- . iter ( )
109- . flat_map ( |r| r. frames . iter ( ) )
110- . map ( |f| f. time_us )
111- . max ( )
112- . unwrap_or ( 1 ) ;
107+ // Use global max_time for y-axis scaling (unified across all charts)
108+ let max_time = global_max_time;
113109
114110 let max_frame = runs
115111 . iter ( )
@@ -349,6 +345,15 @@ pub fn generate_svg(benchmarks: &[BenchmarkData]) -> String {
349345 let total_width = benchmarks. len ( ) as f64 * ( chart_total_width + CHART_SPACING ) ;
350346 let total_height = CHART_HEIGHT ;
351347
348+ // Find global max time across all benchmarks for unified y-axis scale
349+ let global_max_time = benchmarks
350+ . iter ( )
351+ . flat_map ( |b| b. runs . iter ( ) )
352+ . flat_map ( |r| r. frames . iter ( ) )
353+ . map ( |f| f. time_us )
354+ . max ( )
355+ . unwrap_or ( 1 ) ;
356+
352357 // Create document
353358 let mut document =
354359 Document :: new ( ) . set ( "viewBox" , ( 0 , 0 , total_width as i32 , total_height as i32 ) ) ;
@@ -369,7 +374,8 @@ pub fn generate_svg(benchmarks: &[BenchmarkData]) -> String {
369374 let x_offset = i as f64 * ( chart_total_width + CHART_SPACING ) ;
370375 let y_offset = 0.0 ;
371376 let base_hue = BASE_HUES [ i % BASE_HUES . len ( ) ] ;
372- let chart_group = generate_benchmark_chart ( benchmark, base_hue, x_offset, y_offset) ;
377+ let chart_group =
378+ generate_benchmark_chart ( benchmark, base_hue, x_offset, y_offset, global_max_time) ;
373379 document = document. add ( chart_group) ;
374380 }
375381
0 commit comments