diff --git a/desktop/sources/scripts/library.js b/desktop/sources/scripts/library.js index ba5922d..dafbfe9 100644 --- a/desktop/sources/scripts/library.js +++ b/desktop/sources/scripts/library.js @@ -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 + } } diff --git a/examples/dejong.lisp b/examples/dejong.lisp index c701fa7..9e3eac6 100644 --- a/examples/dejong.lisp +++ b/examples/dejong.lisp @@ -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) + ))) )