Skip to content

Commit 59b6463

Browse files
committed
let timeit work with n=1
1 parent f991039 commit 59b6463

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

devtools/test_dashboard/perf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ window.timeit = function(f, n, nchunk, arg) {
4242
times.sort();
4343
var min = (times[0]).toFixed(4);
4444
var max = (times[n - 1]).toFixed(4);
45-
var median = (times[Math.ceil(n / 2)]).toFixed(4);
45+
var median = (times[Math.min(Math.ceil(n / 2), n - 1)]).toFixed(4);
4646
var mean = (totalTime / n).toFixed(4);
4747
console.log((f.name || 'function') + ' timing (ms) - min: ' + min +
4848
' max: ' + max +

0 commit comments

Comments
 (0)