Socket
Book a DemoInstallSign in
Socket

@pjchender/function-benchmarker

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pjchender/function-benchmarker

A simple benchmark for testing function performance

1.0.5
latest
Source
npmnpm
Version published
Weekly downloads
6
Maintainers
1
Weekly downloads
 
Created
Source

Function Benchmarker

Build status version Coverage Status

A simple benchmark for testing function performance. Through the package, you can compare the cost time of different functions.

Guide

Import '@pjchender/function-benchmarker` and make the function you want to test as a parameter. Function-benchmarker will return the cost time executing the function in milliseconds.

const benchmarker = require('@pjchender/function-benchmarker');

function jsonStringify() {
  JSON.stringify({
    foo: 'bar',
  });
}

const costTime = benchmarker(jsonStringify);
console.log('costTime', costTime);

API

By default, function-benchmarker will run the function to test for 1,000,000 times and calculate the cost time (ms). You can pass the times for executing the function as the second parameter.

const costTime = benchmarker(functionToTest, [times]);

Test

$ npm test

LICENSE

MIT

Keywords

performance

FAQs

Package last updated on 19 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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.