From c0075f34c9619e6daa043eb09e058f5a9e6b3265 Mon Sep 17 00:00:00 2001 From: Hanjoung Lee Date: Fri, 4 Dec 2015 14:09:14 +0900 Subject: [PATCH] Some improvements for benchmark view --- benchmark/benchmark.html | 1 + benchmark/benchmark.js | 59 +++++++++++++++++++++++++++++----------- benchmark/common.js | 7 +++++ benchmark/details.html | 42 ++++++++++++++++++++++++++++ 4 files changed, 93 insertions(+), 16 deletions(-) create mode 100644 benchmark/common.js create mode 100644 benchmark/details.html diff --git a/benchmark/benchmark.html b/benchmark/benchmark.html index 150f661ba..0ffd22a71 100644 --- a/benchmark/benchmark.html +++ b/benchmark/benchmark.html @@ -8,6 +8,7 @@ + diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js index 48669904c..3a36a5d3e 100644 --- a/benchmark/benchmark.js +++ b/benchmark/benchmark.js @@ -27,12 +27,20 @@ Object.values = function(obj) { return Object.keys(obj).map(function(key) { return obj[key]; }); }; -function getParameterByName(name) { - name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); - var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), - results = regex.exec(location.search); - return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); -} +Object.sum = function(obj) { + return Object.values(obj).sum(); +}; + +Object.maxKey = function(obj) { + var key, val = -Infinity; + for (var p in obj) { + if (val < obj[p]) { + key = p; + val = obj[p]; + } + } + return key; +}; function wrapTooltip(content) { return '
' + content + '
'; @@ -60,7 +68,7 @@ var link_code = { 'jerryscript': 'https://github.com/Samsung/jerryscript/commit/', 'duktape': 'https://github.com/svaarala/duktape/commit/' }; -var beginDate = new Date('2015-07-10'); +var beginDate = new Date('2015-07-11'); var benchmarkData = {}; @@ -100,20 +108,27 @@ $(document).ajaxStop(function () { transData[date] = []; transInfo[date] = element['info']; engines.forEach(function(engine, index) { - var repVal = undefined; // default value + var sum = undefined; // default value + var max = undefined; // default value + var maxTest = ''; // default value var numTests = 0; var benchmark_obj = element[benchmark]; if (benchmark_obj) { var record = benchmark_obj[measureType][engine]; if (record) { - // record object contains a lot of subtests, - // we use sum of all values as representative value - var values = Object.values(record); - repVal = isSum ? values.sum() : values.max(); - numTests = values.length; + sum = Object.sum(record); + maxTest = Object.maxKey(record); + max = record[maxTest]; + numTests = Object.values(record).length; } } - transData[date][index] = {tests: numTests, score: repVal}; + transData[date][index] = { + tests: numTests, + sum: sum, + max: max, + maxTest: maxTest, + score: isSum ? sum : max + }; }); }); @@ -133,16 +148,28 @@ $(document).ajaxStop(function () { var engine_pure = engine.split('-')[0]; var info = transInfo[date] ? transInfo[date][engine_pure] : undefined; var score = value.score ? value.score.toFixed(2) + measureUnits[measureType] : ''; - var tests = value.tests ? value.tests : 0; + var tests = value.tests || 0; + var max_test = value.maxTest || ''; + var info_text = ''; if (info && info.version) info_text = wrapHyperlink(link_code[engine_pure] + info.version, info.version); var engine_text = wrapHyperlink(link_main[engine_pure], engine); + var score_text = score; + if (isSum) { + score_text += ' (' + tests + ' subtests)'; + } + else { + score_text += ' (' + max_test + ')'; + } + score_text += ' ' + wrapHyperlink('details.html?' + $.param({date: date, engine: engine, benchmark:benchmark}), 'details'); + var textData = [ ['source  ', engine_text], ['version ', info_text], ['date    ', date], - ['score   ', score + ' (' + tests + ' subtests)']]; + ['score   ', score_text]]; + return wrapTooltip(textData.map(function(v) { return v.join(': '); }).join('
')); }); diff --git a/benchmark/common.js b/benchmark/common.js new file mode 100644 index 000000000..d9ee61a11 --- /dev/null +++ b/benchmark/common.js @@ -0,0 +1,7 @@ +function getParameterByName(name) { + name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); + var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), + results = regex.exec(location.search); + return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); +} + diff --git a/benchmark/details.html b/benchmark/details.html new file mode 100644 index 000000000..7ee68b6d6 --- /dev/null +++ b/benchmark/details.html @@ -0,0 +1,42 @@ + + + + + jerryscript benchmark details + + + + + + + + + + + +