timer
Record accurate measurements of execution time. It's really simple, first run timer.start();
, do some stuff, then run timer.stop();
. That's all.
Installation
$ npm install basic-timer
Usage
var timer = require('basic-timer');
timer.start();
timer.stop();
Example
Some things are incredibly interesting to measure. Check out this simple example of timing how long it takes to iterate through an array of length 10000 and assigning each element a random number. Play around with adding and removing 0s from the array declaration and measuring the difference in execution time.
var timer = require('basic-timer');
var arr = new Array(10000);
timer.start();
for (var i = 0; i < arr.length; i++) {
arr[i] = Math.random();
}
timer.stop();
License
MIT