1.0.1 • Published 9 years ago

basic-timer v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

timer

NPM version build status license

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');
var timer = Timer();

// start
timer.start();

// stop
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 timer = Timer();

var arr = new Array(10000);

timer.start();

for (var i = 0; i < arr.length; i++) {
  arr[i] = Math.random();
}

timer.stop();

License

MIT

1.0.1

9 years ago

1.0.0

9 years ago

0.1.0

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago