add benchmark function
This commit is contained in:
parent
e8713f34ae
commit
ad941de3a1
@ -347,4 +347,11 @@ function Library (ronin) {
|
||||
}
|
||||
return a === b
|
||||
}
|
||||
|
||||
this.benchmark = async (fn) => { // logs time taken to execute a function
|
||||
const start = Date.now()
|
||||
const result = await fn()
|
||||
console.log(`time taken: ${Date.now() - start}ms`)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
@ -25,5 +25,11 @@
|
||||
(2 1)
|
||||
)
|
||||
)
|
||||
(dejong 1280 1.6 -2.3 2.4 -2.1)
|
||||
(benchmark (lambda ()
|
||||
(dejong 12800
|
||||
(random -2 2)
|
||||
(random -2 2)
|
||||
(random -2 2)
|
||||
(random -2 2)
|
||||
)))
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user