Socket
Socket
Sign inDemoInstall

nodejs-package-benchmark

Package Overview
Dependencies
142
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nodejs-package-benchmark

This package allows you to benchmark different runtimes using popular packages operations.


Version published
Weekly downloads
8
decreased by-27.27%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

nodejs-package-benchmark

This package allows you to benchmark different runtimes using popular packages operations.

Supported packages

  • fastify
  • lodash
  • prettier
  • babel
  • moment
  • dotenv
  • pinojs
  • winston
  • underscore

Install

npm i -g nodejs-package-benchmark

Comparison

To compare binaries, you can use the bench-it script.

Syntax: bench-it $BINARY ["baseline"]

This script allows you to compare the performance of binaries. If it's your first run, you need to generate the baseline data using:

$ bench-it ./node baseline

To compare subsequent runs, simply omit the "baseline" option:

$ bench-it ./node

Note: It's recommended to have colordiff installed for a clearer comparison of differences.

Single run

To a pretty terminal output, run index.js

$ node index.js
Running Node.js Package Benchmark...
----------------------------------------------------------
babel
  transform (code=true ast=true):                         70.09 (3 samples)
  transform (code=false):                                 78.57 (2 samples)
dotenv
  config:                                                 31.09K (5 samples)
lodash
  .chunk:                                                 24.47M (5 samples)
  .groupBy:                                               3.343M (7 samples)
  .includes:                                              10.35M (6 samples)
  .orderBy:                                               921.3K (8 samples)
moment
  format (full):                                          504.7K (7 samples)
  format:                                                 441K (4 samples)
  fromNow (YYYYMMDD):                                     73K (9 samples)
  subtract (10):                                          134K (5 samples)
pinojs
  info (10x):                                             109.1K (4 samples)
prettier
  format (semi=true):                                     773.5K (3 samples)
  format (singleQuote=true semi=true tabs=true):          593.7K (3 samples)
  format (singleQuote=false semi=false tabs=false):       473.4K (3 samples)
underscore
  .chunk:                                                 3.15M (3 samples)
  .groupBy:                                               1.003M (3 samples)
  .includes:                                              6.588M (4 samples)
  .orderBy:                                               488.7K (5 samples)
winston
  info (10x):                                             24.48K (4 samples)

To store it as JSON, just pipe output to a file:

$ node index.js > results.json
$ cat result.json
[
  {
    "name": "babel",
    "method": "benchmarkjs",
    "operations": [
      {
        "name": "transform (code=true ast=true)",
        "opsSec": 67.80076532539411,
        "samples": 3
      },
      {
...

Keywords

FAQs

Last updated on 11 Apr 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc