Skip to content

Commit acea915

Browse files
committed
feat: throw if no runs will be performed
1 parent 389072b commit acea915

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/time.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ const shuffle = (arr) => {
5151
* @returns {TimeRepoResult}
5252
*/
5353
const timeRepo = (algos, args, runs, id) => {
54+
if (runs < 1) throw new RangeError(`runs:${runs} must be > 0`)
55+
5456
// Initialize data object
5557
const times = {}
5658
for (const algo of algos) {
@@ -60,7 +62,6 @@ const timeRepo = (algos, args, runs, id) => {
6062
// Run timing and sum results
6163
for (let r = 0; r < runs; r++) {
6264
shuffle(algos)
63-
6465
for (const algo of algos) {
6566
times[algo.id] += timeFun(algo.fun, args)
6667
}

0 commit comments

Comments
 (0)