Skip to content

Commit 5eeecc2

Browse files
Report total bootstrap time correctly on compare page
1 parent be279a2 commit 5eeecc2

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

site/src/comparison.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,16 @@ impl ArtifactDescription {
460460
let bootstrap = conn
461461
.get_bootstrap_by_crate(&[conn.artifact_id(&artifact).await])
462462
.await;
463-
let bootstrap = bootstrap
463+
let total_bootstrap = bootstrap
464+
.values()
465+
.filter_map(|v| {
466+
v.get(0)
467+
.copied()
468+
.unwrap_or_default()
469+
.map(|v| v.as_nanos() as u64)
470+
})
471+
.sum::<u64>();
472+
let mut bootstrap = bootstrap
464473
.into_iter()
465474
.filter_map(|(k, mut v)| {
466475
v.pop()
@@ -478,6 +487,8 @@ impl ArtifactDescription {
478487
})
479488
.collect::<HashMap<_, _>>();
480489

490+
bootstrap.insert("$total".to_owned(), total_bootstrap);
491+
481492
let pr = if let ArtifactId::Commit(c) = &artifact {
482493
if let Some(m) = master_commits.iter().find(|m| m.sha == c.sha) {
483494
m.pr

site/static/compare.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -610,9 +610,8 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
610610
return testCases;
611611
},
612612
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;
616615
return { a, b };
617616
},
618617
bootstraps() {
@@ -628,7 +627,9 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
628627
b: format(b),
629628
percent: 100 * (b - a) / a
630629
};
631-
}).sort((a, b) => Math.abs(b.percent) - Math.abs(a.percent));
630+
})
631+
.filter(e => e.name != "$total")
632+
.sort((a, b) => Math.abs(b.percent) - Math.abs(a.percent));
632633
},
633634
before() {
634635
if (!this.data) {
@@ -814,4 +815,4 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
814815
</script>
815816
</body>
816817

817-
</html>
818+
</html>

0 commit comments

Comments
 (0)