tictoc
A simple timer just like matlab's tic()
and toc()
functions.
npm install tictoc
See it in action:
var tic = require('tictoc').tic
var toc = require('tictoc').toc;
tic();
for (i = 0; i < 2000000; i++) {
console.log('I love node? Yep.');
}
toc();
Output:
I love node? Yep.
I love node? Yep.
I love node? Yep.
[...]
70 milliseconds elapsed [0]
The [0]
at the end means it was the only timer running. If you had another timer inside of the the first pair of tictocs, you're see a [1]
. See the examples
dir to see this in action.