time-method
Monkeypatch an object's methods to measure how long they take. Supports sync methods and methods that return promises
Usage
var Q = var MethodTimer = {} Bobprototype {}Bobprototype { return Q} var bob = var timer = MethodTimer// or use MethodTimer.timerFor(Bob.prototype) to time functions// across all instances of Bobtimertimer// alternately, to time all functions of an object, use:// MethodTimer.timeFunctions(bob)bobbob // logs (time units are nanonseconds):// [ // { // method: 'async',// time: 107598145,// invocations: 1,// timePerInvocation: 107598145 // },// { // method: 'sync',// time: 82592,// invocations: 1,// timePerInvocation: 82592 // } // ]