fprofile
A simple function profiler.
The tool hooks to functions (standalone or class methods) and evaluates their execution time and if verbose mode is toggled, also prints their return type and value.
Install
$ npm install fprofile
Usage
var profile = ; /** * Adds profiling hooks to object's function(s) * @param {Object/Function} object or function * @param * @param **/
Example
Look, test.js contains a few examples:
var profile = ; { return n > 1 ? n * : n;} var timedFunction = ;;;; var testObject = factorial: factorial { return hello: 'world' ; }; ;testObject;testObject; ;console;console;
Running the code above outputs:
$ node test.jsfactorial: 0.133msfactorial: 0.02msfactorial: 0.232msObject.factorial @time 0.194ms @type number @return 120 @time 0.21ms @type object @return {"hello":"world"}helloConsole.log: 0.375msworldConsole.log: 0.0329ms
Contribute if you want.