npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nodejs-package-benchmark

v1.1.0-beta.3

Published

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

Downloads

6

Readme

nodejs-package-benchmark

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

Supported packages

  • [x] ~fastify~ - Temporary disabled.
  • [x] lodash
  • [x] prettier
  • [x] babel
  • [x] moment
  • [x] dotenv
  • [x] pinojs
  • [x] winston
  • [x] underscore
  • [x] typescript

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

[!TIP] 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
cpu: 13th Gen Intel(R) Core(TM) i5-13600K (20 cores)
node: v20.13.1 (/home/hzk/.nvm/versions/node/v20.13.1/bin/node)
os: Linux 5.15.133.1-microsoft-standard-WSL2 x64
---------------------------------------------------------------------
babel
  transform (code=true ast=true):                                    147.1 (15 samples)
  transform (code=false):                                            150.4 (16 samples)
dotenv
  config:                                                            64.39K (6440 samples)
lodash
  .chunk:                                                            19.62M (1961973 samples)
  .groupBy:                                                          6.303M (630542 samples)
  .includes:                                                         18.38M (1837801 samples)
  .orderBy:                                                          1.737M (173672 samples)
moment
  format (full):                                                     878.8K (87908 samples)
  format:                                                            839.3K (83928 samples)
  fromNow (YYYYMMDD):                                                153.4K (15339 samples)
  subtract (10):                                                     288.7K (28871 samples)
pinojs
  info (10x):                                                        243.7K (24686 samples)
prettier
  format:                                                            71.71 (10 samples)
  format (singleQuote=true useTabs=true):                            68.52 (10 samples)
  format (semi=false):                                               70.61 (10 samples)
typescript
  transpile:                                                         85.23 (10 samples)
  createSourceFile:                                                  1.866K (187 samples)
  getSemanticDiagnostics:                                            2.102 (10 samples)
underscore
  .chunk:                                                            4.606M (467160 samples)
  .groupBy:                                                          1.66M (169265 samples)
  .includes:                                                         7.626M (762632 samples)
  .orderBy:                                                          733.5K (73352 samples)
winston
  info (10x):                                                        43.13K (4431 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
      },
      {
...