-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
59 lines (50 loc) · 2.04 KB
/
Copy pathindex.html
File metadata and controls
59 lines (50 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<html lang="en">
<head>
<!-- Load plotly.js into the DOM -->
<script src='https://cdn.plot.ly/plotly-2.20.0.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js'></script>
<title>Show benchmarks</title>
</head>
<body>
<div id='chart'><!-- Plotly chart will be drawn inside --></div>
<script lang="js">
d3.json("rust/results.json", function(err, rows) {
function unpack(rows, key) {
return rows.map(function(row) { return row[key]; });
}
let data = [];
// find unique names and commits
let groups = new Set();
rows.forEach(function(row) {
groups.add(JSON.stringify([row.name, row.os, row.arch]));
});
// for each sorted group
[...groups].sort().forEach(function(group) {
group = JSON.parse(group);
// filter rows
let filtered = rows.filter(function(row) {
return row.name === group[0] &&
row.os === group[1] &&
row.arch === group[2];
});
// create trace
let trace = {
type: "scatter",
mode: "lines",
name: group[0],
x: unpack(filtered, 'datetime'),
y: unpack(filtered, 'mean_duration_ns').map(function(value, index, array) {
return array[index] = value / 1000000;
}),
};
// add trace to data
data.push(trace);
});
let layout = {
title: 'Lance Rust Criterion Microbenchmarks',
};
Plotly.newPlot('chart', data, layout);
})
</script>
</body>
</html>