File tree 3 files changed +18
-5
lines changed
3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,7 @@ pub mod comparison {
164
164
pub date : Option < Date > ,
165
165
pub pr : Option < u32 > ,
166
166
pub bootstrap : HashMap < String , u64 > ,
167
+ pub bootstrap_total : u64 ,
167
168
}
168
169
169
170
/// A serializable wrapper for `comparison::ArtifactData`.
Original file line number Diff line number Diff line change @@ -442,6 +442,7 @@ pub struct ArtifactDescription {
442
442
pub pr : Option < u32 > ,
443
443
/// Bootstrap data in the form "$crate" -> nanoseconds
444
444
pub bootstrap : HashMap < String , u64 > ,
445
+ pub bootstrap_total : u64 ,
445
446
}
446
447
447
448
type StatisticsMap = HashMap < TestCase , f64 > ;
@@ -460,6 +461,15 @@ impl ArtifactDescription {
460
461
let bootstrap = conn
461
462
. get_bootstrap_by_crate ( & [ conn. artifact_id ( & artifact) . await ] )
462
463
. await ;
464
+ let bootstrap_total = bootstrap
465
+ . values ( )
466
+ . filter_map ( |v| {
467
+ v. get ( 0 )
468
+ . copied ( )
469
+ . unwrap_or_default ( )
470
+ . map ( |v| v. as_nanos ( ) as u64 )
471
+ } )
472
+ . sum :: < u64 > ( ) ;
463
473
let bootstrap = bootstrap
464
474
. into_iter ( )
465
475
. filter_map ( |( k, mut v) | {
@@ -492,6 +502,7 @@ impl ArtifactDescription {
492
502
pr,
493
503
artifact,
494
504
bootstrap,
505
+ bootstrap_total,
495
506
}
496
507
}
497
508
}
@@ -531,6 +542,7 @@ impl From<ArtifactDescription> for api::comparison::ArtifactDescription {
531
542
} ,
532
543
pr : data. pr ,
533
544
bootstrap : data. bootstrap ,
545
+ bootstrap_total : data. bootstrap_total ,
534
546
}
535
547
}
536
548
}
Original file line number Diff line number Diff line change @@ -610,9 +610,8 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
610
610
return testCases ;
611
611
} ,
612
612
bootstrapTotals ( ) {
613
- const sum = bootstrap => Object . entries ( bootstrap ) . map ( e => e [ 1 ] / 1e9 ) . reduce ( ( sum , next ) => sum + next , 0 ) ;
614
- const a = sum ( this . data . a . bootstrap ) ;
615
- const b = sum ( this . data . b . bootstrap ) ;
613
+ const a = this . data . a . bootstrap_total / 1e9 ;
614
+ const b = this . data . b . bootstrap_total / 1e9 ;
616
615
return { a, b } ;
617
616
} ,
618
617
bootstraps ( ) {
@@ -628,7 +627,8 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
628
627
b : format ( b ) ,
629
628
percent : 100 * ( b - a ) / a
630
629
} ;
631
- } ) . sort ( ( a , b ) => Math . abs ( b . percent ) - Math . abs ( a . percent ) ) ;
630
+ } )
631
+ . sort ( ( a , b ) => Math . abs ( b . percent ) - Math . abs ( a . percent ) ) ;
632
632
} ,
633
633
before ( ) {
634
634
if ( ! this . data ) {
@@ -814,4 +814,4 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
814
814
</ script >
815
815
</ body >
816
816
817
- </ html >
817
+ </ html >
You can’t perform that action at this time.
0 commit comments