Update benchmark.js

This commit is contained in:
Hanjoung Lee
2015-11-20 15:13:24 +09:00
parent 4f8991b2d8
commit fdf5689ca4
+8 -4
View File
@@ -92,6 +92,7 @@ $(document).ajaxStop(function () {
transInfo[date] = element['info']; transInfo[date] = element['info'];
engines.forEach(function(engine, index) { engines.forEach(function(engine, index) {
var repVal = undefined; // default value var repVal = undefined; // default value
var numTests = 0;
var benchmark_obj = element[benchmark]; var benchmark_obj = element[benchmark];
if (benchmark_obj) { if (benchmark_obj) {
var record = benchmark_obj[measureType][engine]; var record = benchmark_obj[measureType][engine];
@@ -100,9 +101,10 @@ $(document).ajaxStop(function () {
// we use sum of all values as representative value // we use sum of all values as representative value
var values = Object.values(record); var values = Object.values(record);
repVal = values.sum(); repVal = values.sum();
numTests = values.length;
} }
} }
transData[date][index] = repVal; transData[date][index] = {tests: numTests, score: repVal};
}); });
}); });
@@ -121,7 +123,8 @@ $(document).ajaxStop(function () {
var engine = engines[index]; var engine = engines[index];
var engine_pure = engine.split('-')[0]; var engine_pure = engine.split('-')[0];
var info = transInfo[date] ? transInfo[date][engine_pure] : undefined; var info = transInfo[date] ? transInfo[date][engine_pure] : undefined;
var score = value ? value.toFixed(2) + measureUnits[measureType] : ''; var score = value.score ? value.score.toFixed(2) + measureUnits[measureType] : '';
var tests = value.tests ? value.tests : 0;
var info_text = ''; var info_text = '';
if (info && info.version) if (info && info.version)
info_text = wrapHyperlink(link_code[engine_pure] + info.version, info.version); info_text = wrapHyperlink(link_code[engine_pure] + info.version, info.version);
@@ -130,14 +133,15 @@ $(document).ajaxStop(function () {
['source  ', engine_text], ['source  ', engine_text],
['version ', info_text], ['version ', info_text],
['date    ', date], ['date    ', date],
['score   ', score]]; ['score   ', score],
['tests   ', tests]];
return wrapTooltip(textData.map(function(v) { return v.join(': '); }).join('<br />')); return wrapTooltip(textData.map(function(v) { return v.join(': '); }).join('<br />'));
}); });
// zip data and tooltips // zip data and tooltips
// so the array will be like [data, tooltip, data, tooltip, ...] // so the array will be like [data, tooltip, data, tooltip, ...]
row = row.map(function (v, i) { row = row.map(function (v, i) {
return [v, tooltips[i]]; return [v.score, tooltips[i]];
}).reduce(function(a, b) { }).reduce(function(a, b) {
return a.concat(b) return a.concat(b)
}); });