// Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved. This // code is released under a tri EPL/GPL/LGPL license. You can use it, // redistribute it and/or modify it under the terms of the: // // Eclipse Public License version 1.0 // GNU General Public License version 2 // GNU Lesser General Public License version 2.1 $(function(){ // Colours from http://emilis.info/other/extended_tango/ var implementation_colours = { // MRI in red "1.8.7-p375": "#270000", "1.9.3-p551": "#600000", "2.0.0-p647": "#a40000", "2.1.7": "#cc0000", "2.2.3": "#ef2929", "2.3.0-dev": "#f05858", // JRuby in blue "jruby-9.0.4.0-int": "#00202a", "jruby-9.0.4.0-noindy": "#0a3050", "jruby-9.0.4.0-indy": "#204a87", "jruby-dev-int": "#3465a4", "jruby-dev-noindy": "#729fcf", "jruby-dev-indy": "#97c4f0", // Rubinius in grey "rbx-2.5.8-int": "#555753", "rbx-2.5.8": "#babdb6", // Topaz in green "topaz-dev": "#73d216", // Truffle in purple "jruby-dev-truffle-nograal": "#5c3566", "jruby-dev-truffle-graal": "#ad7fa8" }; var best_implementations = [ "2.2.3", "jruby-9.0.4.0-indy", "jruby-dev-indy", "rbx-2.5.8", "topaz-dev", "jruby-dev-truffle-graal" ] var synthetic_benchmarks = [ "classic-binary-trees", "classic-fannkuch-redux", "classic-mandelbrot", "classic-n-body", "classic-pidigits", "classic-spectral-norm", "classic-richards", "classic-deltablue" ] var production_benchmarks = [ "chunky-canvas-resampling-steps-residues", "chunky-canvas-resampling-steps", "chunky-canvas-resampling-nearest-neighbor", "chunky-canvas-resampling-bilinear", "chunky-decode-png-image-pass", "chunky-encode-png-image-pass-to-stream", "chunky-color-compose-quick", "chunky-color-r", "chunky-color-g", "chunky-color-b", "chunky-color-a", "chunky-operations-compose", "chunky-operations-replace", "psd-imagemode-rgb-combine-rgb-channel", "psd-imagemode-cmyk-combine-cmyk-channel", "psd-imagemode-greyscale-combine-greyscale-channel", "psd-imageformat-rle-decode-rle-channel", "psd-imageformat-layerraw-parse-raw", "psd-color-cmyk-to-rgb", "psd-compose-normal", "psd-compose-darken", "psd-compose-multiply", "psd-compose-color-burn", "psd-compose-linear-burn", "psd-compose-lighten", "psd-compose-screen", "psd-compose-color-dodge", "psd-compose-linear-dodge", "psd-compose-overlay", "psd-compose-soft-light", "psd-compose-hard-light", "psd-compose-vivid-light", "psd-compose-linear-light", "psd-compose-pin-light", "psd-compose-hard-mix", "psd-compose-difference", "psd-compose-exclusion", "psd-renderer-clippingmask-apply", "psd-renderer-mask-apply", "psd-renderer-blender-compose", "psd-util-clamp", "psd-util-pad2", "psd-util-pad4" ] Chart.defaults.global.multiTooltipTemplate = "<%=datasetLabel%>: <%= value %>"; Chart.defaults.global.animation = false; function product(samples) { return samples.reduce(function(a, b) { return a * b; }, 1); } function geo_mean(samples) { return Math.pow(product(samples), 1 / samples.length); } function lookup(measurements, benchmark, implementation) { var filtered = measurements.filter(function(m) { return m.benchmark == benchmark && m.implementation == implementation; }); if (filtered.length == 0 || filtered[0] == undefined) { console.log("no hit for " + benchmark + " " + implementation); } return filtered[0]; } var speedup_reference_implementation = bench_data.implementations[0]; var speedup_summarised = true; var speedup_visible_implementations = bench_data.implementations; var speedup_visible_benchmarks = bench_data.benchmarks; var speedup_chart; var rebuild_speedup_disabled = false; function rebuild_speedup() { if (rebuild_speedup_disabled) { return; } var speedup_data; if (speedup_summarised) { speedup_data = { labels: speedup_visible_implementations, datasets: [ { fillColors: speedup_visible_implementations.map(function(i) { return implementation_colours[i]; }), strokeColors: speedup_visible_implementations.map(function(i) { return implementation_colours[i]; }), data: speedup_visible_implementations.map(function(i) { return geo_mean(speedup_visible_benchmarks .filter(function(b) { return !(lookup(bench_data.measurements, b, speedup_reference_implementation).failed || lookup(bench_data.measurements, b, i).failed); }).map(function(b) { return lookup(bench_data.measurements, b, i).score / lookup(bench_data.measurements, b, speedup_reference_implementation).score; } )); }), error: speedup_visible_implementations.map(function(i) { return geo_mean(speedup_visible_benchmarks .filter(function(b) { return !(lookup(bench_data.measurements, b, speedup_reference_implementation).failed || lookup(bench_data.measurements, b, i).failed); }).map(function(b) { var score = lookup(bench_data.measurements, b, i).score; var relative_score = score / lookup(bench_data.measurements, b, speedup_reference_implementation).score; var ratio = score / relative_score; return lookup(bench_data.measurements, b, i).score_error / ratio; } )); }) } ] }; } else { speedup_data = { labels: speedup_visible_benchmarks, datasets: speedup_visible_implementations.map(function(i) { return { label: i, fillColor: implementation_colours[i], strokeColor: implementation_colours[i], data: speedup_visible_benchmarks.map(function(b) { if (lookup(bench_data.measurements, b, speedup_reference_implementation).failed || lookup(bench_data.measurements, b, i).failed) { return 0; } else { return lookup(bench_data.measurements, b, i).score / lookup(bench_data.measurements, b, speedup_reference_implementation).score; } }), error: speedup_visible_benchmarks.map(function(b) { if (lookup(bench_data.measurements, b, speedup_reference_implementation).failed || lookup(bench_data.measurements, b, i).failed) { return 0; } else { var score = lookup(bench_data.measurements, b, i).score; var relative_score = score / lookup(bench_data.measurements, b, speedup_reference_implementation).score; var ratio = score / relative_score; return lookup(bench_data.measurements, b, i).score_error / ratio; } }), }; }) }; } if (speedup_chart != undefined) { speedup_chart.destroy(); $("#speedup_chart")[0].width = 600; $("#speedup_chart")[0].height = 400; } speedup_chart = new Chart($("#speedup_chart")[0].getContext("2d")).Bar(speedup_data); } rebuild_speedup(); $("#summary-summarised").change(function() { speedup_summarised = $('#summary-summarised').is(':checked'); rebuild_speedup(); }); $("#speedup-baseline").change(function(option) { speedup_reference_implementation = $(this).find('option:selected').val(); rebuild_speedup(); }); var speedup_impl_checkboxes = {}; bench_data.implementations.forEach(function(i) { $("#speedup-baseline").append($("").text(i)); var checkbox = $(""); speedup_impl_checkboxes[i] = checkbox; checkbox.change(function() { if (checkbox.is(':checked')) { speedup_visible_implementations = bench_data.implementations.filter(function(ip) { return speedup_visible_implementations.indexOf(ip) != -1 || ip == i; }); } else { speedup_visible_implementations = bench_data.implementations.filter(function(ip) { return speedup_visible_implementations.indexOf(ip) != -1 && ip != i; }); } rebuild_speedup(); }); $("#speedup-implementations") .append($("