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

benchforge

v0.2.5

Published

GC aware benchmarking/profiling, with an interactive viewer. For Node and browser.

Readme

Benchforge

Benchforge helps you make faster JavaScript programs with integrated tools for benchmarking and performance analysis in Node.js and Chrome, including features designed specifically for analyzing garbage-collected programs.

Garbage collection is intermittent and infrequent, which makes it harder to identify true performance issues. Typical perf tools isolate microbenchmarks from GC, but that hides a key part of real-world performance. Intermittent events also lead to statistically skewed measurement distributions. Perf tools that assume normal distributions and noise-free test runs can easily create misleading false-positive performance reports. Benchforge captures a truer picture of garbage-collected programs:

  • GC-aware statistics -- bootstrap confidence intervals account for GC variance instead of hiding it.
  • Heap allocation profiling -- see which functions allocate the most, including short-lived objects already collected.
  • GC collection reports -- allocation rates, scavenge/full GC counts, promotion %, and pause times per iteration.
  • Visualization -- distribution plots, icicle charts for allocators, source annotations with allocation and call count metrics.
  • Archive -- save traces and source code together to share with your team.

Timing Distributions

Heap Allocation

Explore memory allocation per function:

Benchmark Iteration Time Series

Source Code Annotated with Performance Info

Installation

npm install benchforge
# or
pnpm add benchforge

Quick Start: Node

The simplest benchmark: export a default function and pass the file to benchforge.

// my-bench.ts
export default function (): string {
  return "a" + "b";
}
benchforge my-bench.ts --gc-stats

For suites with multiple benchmarks, groups, and baseline comparison, see Node.md.

Quick Start: Browser

benchforge --url <page> opens Chromium and runs your program.

You can time any page without modification, and compare against a baseline.

benchforge --url http://localhost:5173 --baseline-url http://localhost:5174 \
  --gc-stats --batches 20 --iterations 10 --headless

If you export your test function as window.__bench, benchforge can run multiple iterations in the same tab, which helps reveal the accumulated effect of heap allocation over time. Tests also run faster.

<!-- bench function mode -->
<script>
window.__bench = () => {
  const arr = Array.from({ length: 10000 }, () => Math.random());
  arr.sort((a, b) => a - b);
};
</script>

See Browser.md for setup patterns, completion signals, and the CDP flow.

CLI Overview

Core flags for common workflows. Run benchforge --help for the full list.

| Flag | What it does | |------|-------------| | --gc-stats | GC allocation/collection stats | | --alloc | Heap allocation sampling attribution | | --profile | V8 CPU time sampling profiler | | --call-counts | Per-function execution counts | | --stats <list> | Timing columns to display (default: mean,p50,p99) | | --view | Open interactive viewer in browser | | --archive [file] | Archive profiles + sources to .benchforge file | | --duration <sec> | Duration per batch (default: 0.642s) | | --iterations <n> | Exact iterations (overrides --duration) | | --batches <n> | Interleaved batches for baseline comparison | | --filter <pattern> | Run only benchmarks matching regex/substring | | --url <url> | Benchmark a browser page | | --baseline-url <url> | A/B comparison in browser | | --equiv-margin <pct> | Equivalence margin (default: 2%) |

See Profiling.md for detailed profiling options and V8 flags.

Key Concepts

Batching

When comparing against a baseline, use --batches to interleave runs and reduce ordering bias. Batch 0 is dropped by default (OS cache warmup). For reliable comparisons, use 40+ batches.

benchforge sorting.ts --batches 40 --duration 2

See Statistics.md for the full explanation of batched execution, block bootstrap, and Tukey trimming.

Baseline Comparison

When a group has a baseline, all benchmarks show Δ% with a bootstrap confidence interval. The result is classified as faster, slower, equivalent, or inconclusive based on the equivalence margin.

See Statistics.md for how the four verdicts work and how to calibrate the margin.

Further Reading

  • Node.md -- Worker mode, module imports, custom metric sections, external debugger attachment
  • Browser.md -- Bench function and page-load modes, completion signals, CDP flow
  • Profiling.md -- Allocation sampling, GC stats, V8 flags, Perfetto export
  • Statistics.md -- Column selection (--stats), bootstrap methods, batching, equivalence testing
  • README-tachometer.md -- Coming from tachometer