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

timeit-js

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timeit-js - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

12

index.js

@@ -5,3 +5,3 @@ function roundTo(decimalPlaces, numberToRound) {

function startTimer() {
function startTimer () {
const time = process.hrtime()

@@ -11,3 +11,3 @@ return time

function endTimer(time) {
function endTimer (time) {
const diff = process.hrtime(time)

@@ -20,3 +20,3 @@ const NS_PER_SEC = 1e9

function timer(fn, args, executions=100000) {
function timer (fn, args, e) {
const start = startTimer()

@@ -29,4 +29,3 @@ for (var i = 1; i < executions; i++) {

function timeIt (fn, args, r=100, e=100000) {
function measure (fn, args, e=100000, r=1) {
let results = []

@@ -36,3 +35,2 @@ for (let i = 0; i < r; i++) {

}
const result = results.reduce((pv, cv) => pv + cv, 0)

@@ -42,2 +40,2 @@ return result / results.length

module.exports = timeIt
module.exports = measure
{
"name": "timeit-js",
"version": "0.0.1",
"version": "0.0.2",
"description": "Performance Measuring for Node JS",

@@ -5,0 +5,0 @@ "main": "index.js",

# timeit-js
Node Performance Measuring
Simple Node Performance Measuring
## Installation
```sh
npm i timeit-js
```
## Import
```js
const timeit = require('timeit-js')
```
## API
```js
/**
* Test your function's execution time.
* @params {Function} fn
* @params {*} args
* @params {Number} e Exections
* @params {Number} r Repetitions
*/
timeit.measure(fn, args, e, r=1)
```
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