took
Easily log how long your function took to call back: wrap it in a took!
Installation
$ npm install took
One liner callback timing
var took = ; fs; // Will log: Reading /etc/passwd took 00:00.001
To time synchronous code, call took twice with the same id
var took = ; ;for var i = 0; i < 300000000; i++ Math; ; // Will log: My slow for loop took 00:02.636
Use took.tick to find out how much time your code took per iteration
var took = ; { var count = 0; { if count++ < 10 console; ; else ; } ;} ; // Will log: Adding took 00:04.301. On average 00:00.430 for 10 iterations at 2.33 per second.
Have the timer wait until the function has been called
var took = ; var toCall = took; ; // Will log: My timeout took 00:01.001
License
MIT