Skip to content

Commit bd94eee

Browse files
Double-column layout for opt/non-opt.
This makes it somewhat shorter of a page, and potentially eases comparison across the two (though it is unknown whether this is necessary -- it seems like a possible usecase, though, especially for future benchmarks where that comparison may be more meaningful, e.g., runtime benchmarks).
1 parent 493da4f commit bd94eee

File tree

4 files changed

+53
-18
lines changed

4 files changed

+53
-18
lines changed

site/src/api.rs

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ pub mod graph {
114114
pub struct Response {
115115
/// Crate -> Benchmark -> [GraphData]
116116
pub benchmarks: HashMap<String, HashMap<String, Vec<GraphData>>>,
117+
pub max: HashMap<String, f64>,
117118
}
118119
}
119120

site/src/server.rs

+16-2
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ pub fn handle_graph(body: graph::Request, data: &InputData) -> ServerResult<grap
120120
trivial = true;
121121
}
122122

123-
let mut entry = entry.entry(name.clone())
123+
let mut entry = entry.entry(name)
124124
.or_insert_with(|| Vec::<graph::GraphData>::with_capacity(elements));
125125
let first = entry.first().map(|d| d.absolute);
126126
let percent = first.map_or(0.0, |f| (value - f) / f * 100.0);
127127
entry
128128
.push(graph::GraphData {
129-
benchmark: name,
129+
benchmark: run.state.name(),
130130
commit: commit.clone(),
131131
url: last_commit.as_ref().map(|c| {
132132
format!("/compare.html?start={}&end={}&stat={}",
@@ -194,7 +194,21 @@ pub fn handle_graph(body: graph::Request, data: &InputData) -> ServerResult<grap
194194
last_commit = Some(commit);
195195
}
196196

197+
let mut maxes = HashMap::new();
198+
for (ref crate_name, ref benchmarks) in &result {
199+
let name = crate_name.replace("-opt", "");
200+
let mut max = 0.0f64;
201+
for points in benchmarks.values() {
202+
for point in points {
203+
max = max.max(point.y);
204+
}
205+
}
206+
let max = maxes.get(&name).cloned().unwrap_or(0.0f64).max(max);
207+
maxes.insert(name, max);
208+
}
209+
197210
Ok(graph::Response {
211+
max: maxes,
198212
benchmarks: result,
199213
})
200214
}

site/static/index.html

+35-8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
<meta charset="utf-8">
55
<title>rustc performance data</title>
66
<link rel="stylesheet" type="text/css" href="perf.css">
7+
<style>
8+
#charts {
9+
width: 100%;
10+
}
11+
div[id^="chart-container"] {
12+
max-width: 50%;
13+
}
14+
</style>
715
</head>
816
<body class="container">
917
<div>&gt; <a href="index.html">graphs</a>, <a href="compare.html">compare</a>.</div>
@@ -55,18 +63,30 @@
5563
return false;
5664
}
5765

58-
let elements = [];
66+
let by_crate = {};
5967
for (let crate_name of sorted_names) {
60-
let element = document.createElement("div");
61-
element.id = "chart-container-" + crate_name;
62-
document.getElementById("charts").appendChild(element);
68+
let key = crate_name.replace("-opt", "");
69+
if (!by_crate[key]) by_crate[key] = [];
70+
by_crate[key].push(crate_name);
71+
}
72+
for (let crate_names of Object.values(by_crate)) {
73+
let wrapper = document.createElement("table");
74+
let row = document.createElement("tr");
75+
wrapper.appendChild(row);
76+
for (let crate_name of crate_names) {
77+
let element = document.createElement("td");
78+
element.id = "chart-container-" + crate_name;
79+
row.appendChild(element);
80+
}
81+
document.getElementById("charts").appendChild(wrapper);
6382
}
6483
let graphs = [];
6584
for (let crate_name of sorted_names) {
6685
graphs.push(() => {
6786
let benchmark_names = Object.keys(response.benchmarks[crate_name]);
6887
benchmark_names.sort();
6988
let datasets = [];
89+
let max = response.max[crate_name.replace("-opt", "")];
7090
for (let name of benchmark_names) {
7191
let data = response.benchmarks[crate_name][name];
7292
datasets.push({
@@ -101,23 +121,30 @@
101121
let date = new Date();
102122
date.setUTCMilliseconds(this.x);
103123
let commit = this.point.commit.substr(0, 10);
104-
let yAxis = crate_name.startsWith("Summary") ? summaryYAxis : yAxis;
124+
let y_axis = crate_name.startsWith("Summary") ? summaryYAxis : yAxis;
105125
return "<b>" + date.toLocaleString() + " - " + commit + "</b>" +
106126
"<br>" + this.series.name + ": " + this.point.absolute.toFixed(2) + " " +
107-
yAxis.toLowerCase() + " (" +
127+
y_axis.toLowerCase() + " (" +
108128
this.point.percent.toFixed(2) + "% from start)";
109129
},
110130
},
111131
xAxis: {
112132
type: "datetime",
113133
},
114134
yAxis: absolute ? {
115-
title: {
135+
title: crate_name.includes("-opt") ? { text: "" } : {
116136
text: crate_name.startsWith("Summary") ? summaryYAxis : yAxis,
117137
},
138+
labels: crate_name.includes("-opt") ? {
139+
enabled: false,
140+
} : {},
118141
min: 0,
142+
max: max * 1.05,
143+
softMax: max * 1.05,
144+
ceiling: max * 1.05,
145+
floor: 0,
119146
} : {
120-
softMax: 5,
147+
max: max * 1.05,
121148
softMin: -5,
122149
minRange: 0.1,
123150
title: {

site/static/perf.css

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
body {
22
font-family: monospace;
3-
margin-top: 20px;
4-
margin-bottom: 10px;
5-
max-width: 1000px;
6-
}
7-
@media (min-width: 992px) {
8-
body {
9-
margin-left: 5%;
10-
}
3+
margin: 1em auto;
114
}
125
p {
136
margin-top: 1.2em;

0 commit comments

Comments
 (0)