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 🙏

© 2026 – Pkg Stats / Ryan Hefner

perfshield

v0.0.10

Published

A tool for doing web benchmarking across multiple JS engines and with statistical signifigance

Readme

perfshield

perfshield is a build-system-agnostic benchmarking tool for comparing two versions of a JavaScript library across JS runtimes. It borrows statistical ideas from Tachometer (confidence intervals, adaptive sampling) and focuses on runtime JS engines (Node/V8 today).

What it does

  • Builds your benchmark bundle using your own build command.
  • Saves a baseline bundle (prepare).
  • Builds the current bundle and compares it to the baseline (compare).
  • Reports results in console and/or JSON.
  • Exits with code 1 when a regression is detected (both relative and absolute CIs exclude 0 in the slower direction).

Requirements

  • Node.js (used for the CLI and the Node engine).
  • A build command that emits a single ESM benchmark bundle.

Install

pnpm add -D perfshield

Quick start

  1. Create a benchmark module that exports benchmarks:
export const benchmarks = [
  {
    name: "sum",
    iterations: 1,
    async fn() {
      let total = 0;
      for (let i = 0; i < 10_000; i += 1) {
        total += i;
      }
      return total;
    },
  },
];
  1. Create a perfshield.config.json:
{
  "artifactsDir": ".perfshield",
  "build": {
    "command": "pnpm run build:bench",
    "output": "dist/bench.js"
  },
  "engines": [
    {
      "name": "node",
      "command": "node"
    }
  ],
  "sampling": {
    "minSamples": 30,
    "timeoutMs": 10000,
    "conditions": [0]
  },
  "report": {
    "formats": ["console", "json"]
  }
}
  1. Run the workflow:
perfshield prepare --config perfshield.config.json
perfshield compare --config perfshield.config.json
  1. (Optional) Calibrate sampling defaults based on the prepared baseline:
perfshield calibrate --config perfshield.config.json

This prints a JSON snippet with recommended sampling values you can paste into your config.

Benchmark bundle contract

The build output must be a single ESM file that exports:

export const benchmarks = [
  {
    name: "example",
    fn: async () => {},
    setup: async () => {},
    teardown: async () => {},
    unit: "ms",
    iterations: 1,
    metadata: { tag: "optional" },
  },
];

Rules:

  • benchmarks is required.
  • fn is required.
  • setup/teardown run once per sample (per benchmark, per version).
  • If setup throws, the sample fails and the run is aborted.
  • iterations repeats fn inside a single sample to reduce noise.

Artifacts

  • prepare stores a baseline bundle in artifactsDir (default .perfshield).
  • compare uses the stored baseline and the newly built bundle.

Reports

Supported formats:

  • console: human‑readable summary.
  • json: machine‑readable report.

If any benchmark shows a regression (both relative and absolute CIs exclude 0 in the slower direction), the process exits with code 1.

Examples

See examples/simple for a minimal setup you can run locally.