From 28cc0da151ede6f275d9e67810dc6a45e5498c33 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Sun, 10 Aug 2014 09:23:48 +0200 Subject: [PATCH] hwtest.js: Fix median computation By default Array.prototype.sort() sorts all values by converting them to strings, even numbers! --- js/perf/hwtest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/perf/hwtest.js b/js/perf/hwtest.js index fbadde433..9cc0db85e 100644 --- a/js/perf/hwtest.js +++ b/js/perf/hwtest.js @@ -270,7 +270,7 @@ function script_redrawTestDone(time) { function script_collectTimings(time) { for (let timing in redrawTimes) { let times = redrawTimes[timing]; - times.sort(); + times.sort(function(a, b) { return a - b }); let len = times.length; let median;