Javascriptfunction run(fn, count, ...args) { const = start = performance.now(); for (let i = 0; i < count; ++i) { fn.apply(null, args); } return performance.now() - start; }
Javascript[10, 100, 1000, 10000].forEach( x => { console.log("testFunc1", x, run("testFunc1", x, "foo"); console.log("testFunc2", x, run("testFunc2", x, "foo"); });