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

execution-time

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

execution-time

ultility to measure execution time

  • 1.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
48K
increased by21.24%
Maintainers
1
Weekly downloads
 
Created
Source

execution-time

Build Status

NPM

node.js utility to measure execution time in code

Install

npm install execution-time --save

Usage

const perf = require('execution-time')();

//at beginning of your code
perf.start();

//at end of your code
const results = perf.stop();
console.log(results.time);  // in milliseconds

Named performance measurer

const perf = require('execution-time')();

//at beginning of your code, pass any name
perf.start('apiCall');

//at end of your code, pass the same name (anywhere in your flow)
const results = perf.stop('apiCall');
console.log(results.time);  // in milliseconds
console.log(results.preciseWords);  // in words


if you dont care about results but just want to print results

sample usage with debug

const debug = require('debug')('your-module');
const perf = require('execution-time')(debug);

//at beginning of your code
perf.start();

//at end of your code
perf.stop();

also works with console.log/info/warn

const perf = require('execution-time')(console.log);

//at beginning of your code
perf.start();

//at end of your code
perf.stop();

Keywords

FAQs

Package last updated on 04 Feb 2020

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