Iv looked around for a existing lib/solution for what I want but can't find anything, so Im looking to do it myself, and looking for some pointers.
Im looking to create a javascript testing suite, to do a/b testing on two function, so lets just say I have
function foo(){ var x = new Object();}
and
function bar(){var x = {};}
I want to be able to measure the execution time, the memory usage and any other useful stats (like how benchmark can show operations per second)
What ways are there, using javascript, to measure the above
I know a few, but It would be nice to start from fresh and see what else is out there, so all suggestions are very much welcome
thanks
N.B Im not asking for browser plugins or chrome dev tools, the measuring needs to be done in js
var start = new Date().getTime();
*Your Code*
var end = new Date().getTime(),
time = end - start,
execs = 1000 / time;
console.log('time in ms: '+time);
console.log('operations per second: '+execs);
No idea how you would get the memory usage of the execution...
performance / time: jsperf.com
other profiling - try Chrome's Inspector
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With