Improve benchmark visualization

Instead of intervals just use several columns on a line chart.
This gives us nice tooltips and colors.
This commit is contained in:
Arseny Kapoulkine 2014-11-17 21:13:41 -08:00
parent c2b7ef5417
commit ccb2e71905

View File

@ -48,32 +48,25 @@ Benchmark results are visualized using [Google Charts](https://developers.google
bfiles[file] = file bfiles[file] = file
} }
function drawChartRatio(bd, chartid, logscale) { function drawChartRatio(bd, chartid, haxis) {
var data = new google.visualization.DataTable() var data = new google.visualization.DataTable()
data.addColumn('string', 'parser') data.addColumn('string', 'parser')
data.addColumn('number', 'ratio')
for (var file in bfiles) { for (var file in bfiles) {
data.addColumn({id: file, type: 'number', role: 'interval'}) data.addColumn('number', file)
} }
for (var parser in bd) { for (var parser in bd) {
var row = [] var row = [parser]
var sum = 0
var sumw = 0
for (var file in bfiles) { for (var file in bfiles) {
var ratio = bd[parser][file] / bd['pugixml'][file] var ratio = bd[parser][file] / bd['pugixml'][file]
row.push(ratio) row.push(ratio)
sum += ratio
sumw += 1
} }
data.addRow([parser, sum / sumw].concat(row)) data.addRow(row)
} }
var chartdiv = document.getElementById(chartid) var chartdiv = document.getElementById(chartid)
@ -83,9 +76,9 @@ Benchmark results are visualized using [Google Charts](https://developers.google
orientation: 'vertical', orientation: 'vertical',
title: chartdiv.innerHTML, title: chartdiv.innerHTML,
lineWidth: 0, lineWidth: 0,
pointSize: 5,
chartArea: {width: '65%', height: '90%'}, chartArea: {width: '65%', height: '90%'},
intervals: { style: 'points', pointSize: 5 }, hAxis: haxis
hAxis: { logScale: true }
}; };
var chart = new google.visualization.LineChart(chartdiv) var chart = new google.visualization.LineChart(chartdiv)
@ -98,9 +91,21 @@ Benchmark results are visualized using [Google Charts](https://developers.google
google.setOnLoadCallback(function () { google.setOnLoadCallback(function () {
benchmark(benchmark_data) benchmark(benchmark_data)
drawChartRatio(bdata.speed.x86, 'chart_speed_x86') var hAxisSpeed = {
drawChartRatio(bdata.memory.x86, 'chart_memory_x86') logScale: true,
drawChartRatio(bdata.speed.x64, 'chart_speed_x64') minValue: 0.75,
drawChartRatio(bdata.memory.x64, 'chart_memory_x64') ticks: [1, 3, 9, 27, 81]
}
var hAxisMemory = {
logScale: true,
minValue: 0.25,
ticks: [0.5, 1, 2, 4, 8]
}
drawChartRatio(bdata.speed.x86, 'chart_speed_x86', hAxisSpeed)
drawChartRatio(bdata.memory.x86, 'chart_memory_x86', hAxisMemory)
drawChartRatio(bdata.speed.x64, 'chart_speed_x64', hAxisSpeed)
drawChartRatio(bdata.memory.x64, 'chart_memory_x64', hAxisMemory)
}) })
</script> </script>