Skip to content

Commit e3b7867

Browse files
authored
Merge pull request #1 from rylev/vue
Move comparison page to Vue.js
2 parents 18d6728 + d95009b commit e3b7867

File tree

7 files changed

+607
-687
lines changed

7 files changed

+607
-687
lines changed

site/src/comparison.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,9 @@ pub struct BenchmarkVariances {
473473
}
474474

475475
impl BenchmarkVariances {
476+
const NUM_PREVIOUS_COMMITS: usize = 100;
477+
const MIN_PREVIOUS_COMMITS: usize = 50;
478+
476479
async fn calculate(
477480
ctxt: &SiteCtxt,
478481
from: ArtifactId,
@@ -486,11 +489,11 @@ impl BenchmarkVariances {
486489
.set::<String>(Tag::Profile, selector::Selector::All)
487490
.set(Tag::ProcessStatistic, selector::Selector::One(stat));
488491

489-
let num_commits = 100;
490-
let previous_commits = Arc::new(previous_commits(from, num_commits, master_commits));
491-
if previous_commits.len() < num_commits {
492-
return Ok(None);
493-
}
492+
let previous_commits = Arc::new(previous_commits(
493+
from,
494+
Self::NUM_PREVIOUS_COMMITS,
495+
master_commits,
496+
));
494497
let mut previous_commit_series = ctxt
495498
.query::<Option<f64>>(query, previous_commits.clone())
496499
.await?;
@@ -507,6 +510,9 @@ impl BenchmarkVariances {
507510
}
508511
}
509512
}
513+
if variance_data.len() < Self::MIN_PREVIOUS_COMMITS {
514+
return Ok(None);
515+
}
510516

511517
for (bench, results) in variance_data.iter_mut() {
512518
debug!("Calculating variance for: {}", bench);

site/static/bootstrap.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ <h3>This may take a while!</h3>
281281
window.location.search = params.toString();
282282
}
283283

284-
load_state(state => {
284+
loadState(state => {
285285
let values = Object.assign({}, {
286286
start: "",
287287
end: "",

site/static/compare.html

+372-481
Large diffs are not rendered by default.

site/static/detailed-query.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,14 @@ <h3 id="title"></h3>
309309
let values = Object.assign({
310310
sort_idx: "-2",
311311
}, state);
312-
make_request("/self-profile", values).then(function (data) {
312+
makeRequest("/self-profile", values).then(function (data) {
313313
DATA = data;
314314
data = JSON.parse(JSON.stringify(DATA)); // deep copy
315315
populate_data(data, values);
316316
});
317317
}
318318

319-
load_state(make_data, true);
319+
loadState(make_data, true);
320320
</script>
321321
</body>
322322

site/static/index-old.html

+189-177
Large diffs are not rendered by default.

site/static/index.html

+30-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<!doctype html>
22
<html>
3+
34
<head>
45
<meta charset="utf-8">
56
<link rel="stylesheet" href="uPlot.min.css">
@@ -42,6 +43,7 @@
4243
white-space: pre;
4344
font-family: monospace;
4445
}
46+
4547
body {
4648
padding: 1em;
4749
margin: 0;
@@ -51,10 +53,12 @@
5153
<script src="shared.js"></script>
5254
<title>rustc performance data</title>
5355
</head>
56+
5457
<body>
5558
<div>&gt; <a href="index.html">graphs</a>, <a href="compare.html">compare</a>,
5659
<a href="dashboard.html">dashboard</a>, <a href="bootstrap.html">bootstrap</a>,
57-
<a href="status.html">status</a>, <a href="help.html">help</a>.</div>
60+
<a href="status.html">status</a>, <a href="help.html">help</a>.
61+
</div>
5862
<div id="settings">
5963
start: <input placeholder="yyyy-mm-dd or commit" id="start-bound" />
6064
end: <input placeholder="yyyy-mm-dd or commit" id="end-bound" />
@@ -66,11 +70,17 @@
6670
See <a href="/compare.html">compare page</a> for descriptions of what
6771
the names mean.
6872
</div>
69-
<div id="loading"><h2>Loading &amp; rendering data..</h2><h3>This may take a while!</h3></div>
73+
<div id="loading">
74+
<h2>Loading &amp; rendering data..</h2>
75+
<h3>This may take a while!</h3>
76+
</div>
7077
<div id="charts"></div>
7178
<div id="as-of"></div>
7279
<a href="https://github.com/rust-lang-nursery/rustc-perf">
73-
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png">
80+
<img style="position: absolute; top: 0; right: 0; border: 0;"
81+
src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67"
82+
alt="Fork me on GitHub"
83+
data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png">
7484
</a>
7585

7686
<script>
@@ -84,7 +94,7 @@
8494
const otherCacheStateColors = ["#8085e9", "#f15c80", "#e4d354", "#2b908f", "#f45b5b", "#91e8e1"];
8595
const interpolatedColor = "#fcb0f1";
8696

87-
function tooltipPlugin({onclick, commits, isInterpolated, absoluteMode, shiftX = 10, shiftY = 10}) {
97+
function tooltipPlugin({ onclick, commits, isInterpolated, absoluteMode, shiftX = 10, shiftY = 10 }) {
8898
let tooltipLeftOffset = 0;
8999
let tooltipTopOffset = 0;
90100

@@ -120,9 +130,9 @@
120130
showTooltip();
121131

122132
let top = u.valToPos(u.data[seriesIdx][dataIdx], 'y');
123-
let lft = u.valToPos(u.data[ 0][dataIdx], 'x');
133+
let lft = u.valToPos(u.data[0][dataIdx], 'x');
124134

125-
tooltip.style.top = (tooltipTopOffset + top + shiftX) + "px";
135+
tooltip.style.top = (tooltipTopOffset + top + shiftX) + "px";
126136
tooltip.style.left = (tooltipLeftOffset + lft + shiftY) + "px";
127137

128138
tooltip.style.borderColor = isInterpolated(dataIdx) ?
@@ -139,7 +149,7 @@
139149
}
140150
tooltip.textContent = (
141151
fmtDate(new Date(u.data[0][dataIdx] * 1e3)) + " - " +
142-
commits[dataIdx][1].slice(0,10) + "\n" + trailer
152+
commits[dataIdx][1].slice(0, 10) + "\n" + trailer
143153
);
144154
}
145155

@@ -199,8 +209,8 @@
199209
};
200210
}
201211

202-
function genPlotOpts({title, width, height, yAxisLabel, series, commits,
203-
stat, isInterpolated, alpha = 0.3, prox = 5, absoluteMode}) {
212+
function genPlotOpts({ title, width, height, yAxisLabel, series, commits,
213+
stat, isInterpolated, alpha = 0.3, prox = 5, absoluteMode }) {
204214
return {
205215
title,
206216
width,
@@ -238,11 +248,11 @@
238248
values: (self, splits) => {
239249
return splits.map(v => {
240250
return (
241-
v >= 1e12 ? v/1e12 + "T" :
242-
v >= 1e9 ? v/1e9 + "G" :
243-
v >= 1e6 ? v/1e6 + "M" :
244-
v >= 1e3 ? v/1e3 + "k" :
245-
v
251+
v >= 1e12 ? v / 1e12 + "T" :
252+
v >= 1e9 ? v / 1e9 + "G" :
253+
v >= 1e6 ? v / 1e6 + "M" :
254+
v >= 1e3 ? v / 1e3 + "k" :
255+
v
246256
);
247257
});
248258
},
@@ -261,7 +271,7 @@
261271
ctx.strokeStyle = interpolatedColorWithAlpha;
262272
ctx.beginPath();
263273

264-
let [ i0, i1 ] = u.series[0].idxs;
274+
let [i0, i1] = u.series[0].idxs;
265275

266276
for (let j = i0; j <= i1; j++) {
267277
let v = u.data[0][j];
@@ -282,7 +292,7 @@
282292
tooltipPlugin({
283293
onclick(u, seriesIdx, dataIdx) {
284294
let thisCommit = commits[dataIdx][1];
285-
let prevCommit = (commits[dataIdx-1] || [null,null])[1];
295+
let prevCommit = (commits[dataIdx - 1] || [null, null])[1];
286296
window.open(`/compare.html?start=${prevCommit}&end=${thisCommit}&stat=${stat}`);
287297
},
288298
commits,
@@ -393,7 +403,7 @@
393403
benchmarks[name] = {
394404
check: optInterpolated(Check),
395405
debug: optInterpolated(Debug),
396-
opt: optInterpolated(Opt),
406+
opt: optInterpolated(Opt),
397407
}
398408
});
399409

@@ -415,7 +425,7 @@
415425
window.location.search = params.toString();
416426
}
417427

418-
load_state(state => {
428+
loadState(state => {
419429
let values = Object.assign({}, {
420430
start: "",
421431
end: "",
@@ -427,4 +437,5 @@
427437
});
428438
</script>
429439
</body>
430-
</html>
440+
441+
</html>

site/static/shared.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ function query_string_for_state(state) {
186186
return result;
187187
}
188188

189-
function load_state(callback, skip_settings) {
189+
function loadState(callback, skip_settings) {
190190
let params = new URLSearchParams(window.location.search.slice(1));
191191
let state = {};
192192
for (let param of params) {
@@ -225,7 +225,7 @@ function load_state(callback, skip_settings) {
225225
}
226226

227227
// This one is for making the request we send to the backend.
228-
function make_request(path, body) {
228+
function makeRequest(path, body) {
229229
if (window.msgpack === undefined) {
230230
alert("msgpack is not loaded, maybe allow scripts from cdnjs.cloudflare.com?");
231231
return Promise.reject("msgpack is not loaded");

0 commit comments

Comments
 (0)