This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Finds the performance for a given function | |
* function fn the function to be executed | |
* int n the amount of times to repeat | |
* return array [time for n iterations, average execution frequency (executions per second)] | |
*/ | |
const getPerf = (fn, n) =>{ | |
let start = new Date().getTime() | |
for (let i = 0; i < n; i++) fn(i) |