Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

basic-timer

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

basic-timer

Record accurate measurements of execution time

  • 1.0.1
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 06 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc