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

micron-runner

v1.0.0

Published

Benchmark runner

Downloads

81

Readme

Micron Runner

Benchmark tool that shows how performance scales with input size. Run sweep benchmarks across a range of N values and visualize the results.

micron-runner --sweep 100:5000:500

  array-sort.bench.js
  ┌───────┬──────┬──────┬──────┬──────┐
  │   N   │  min │  avg │  max │  p95 │
  ├───────┼──────┼──────┼──────┼──────┤
  │   100 │   0ms│   0ms│   1ms│   0ms│
  │   600 │   1ms│   1ms│   2ms│   1ms│
  │  1100 │   3ms│   3ms│   4ms│   4ms│
  └───────┴──────┴──────┴──────┴──────┘

Installation

npm install --save-dev micron-runner

or globally:

npm install -g micron-runner

Quick Start

  1. Create a benchmarks/ folder in your project
  2. Add .bench.js files
  3. Run micron-runner
project/
└── benchmarks/
    ├── array-sort.bench.js
    └── db-insert.bench.js

Benchmark File Format

// benchmarks/my-benchmark.bench.js

export const name = 'My benchmark';       // optional label

export async function setup() {
    // runs once before the sweep starts
}

export async function teardown() {
    // runs once after the sweep ends
}

export async function bench(n) {
    // measured code — called n times per step
}

Only bench is required. setup, teardown, and name are optional.

Examples

Pure JS (no dependencies):

// benchmarks/array-sort.bench.js
export async function bench(n) {
    const arr = Array.from({ length: n }, () => Math.random());
    arr.sort((a, b) => a - b);
}

With database setup:

// benchmarks/db-insert.bench.js
import mongoose from 'mongoose';
import User from '../models/user.js';

export async function setup() {
    await mongoose.connect('mongodb://localhost:27017/mydb');
}

export async function teardown() {
    await mongoose.connection.close();
}

export async function bench() {
    await User.create({ name: 'test', email: `test-${Date.now()}@x.com` });
}

CLI Usage

micron-runner                              # auto-detect ./benchmarks
micron-runner ./my-folder                  # custom folder
micron-runner --sweep 100:5000:500         # start:end:step shorthand
micron-runner --start 100 --end 5000 --step 500
micron-runner --repeats 5
micron-runner --json > results.json        # CI-friendly JSON output
micron-runner --quiet                      # errors only
micron-runner --help

Options

| Flag | Alias | Description | Default | |------|-------|-------------|---------| | --sweep start:end:step | | Shorthand for start/end/step | | | --start | -s | Initial N | 100 | | --end | -e | Final N | 2100 | | --step | -i | Step between N values | 500 | | --repeats | -r | Repeats per step | 3 | | --outdir | -o | Output folder | ./results | | --json | -j | Output JSON to stdout, skip HTML | | | --quiet | -q | Suppress all output except errors | |

Programmatic API

import Micron from 'micron-runner';

const runner = new Micron({
    folder: './benchmarks',
    start: 100,
    end: 5000,
    step: 500,
    repeats: 3,
    writeResults: true,   // write HTML chart to outdir
    json: false,          // print JSON to stdout
    quiet: false
});

const results = await runner.run();

Output

After each benchmark file, a table is printed to stdout:

  db-insert.bench.js
  ┌───────┬──────┬──────┬──────┬──────┐
  │   N   │  min │  avg │  max │  p95 │
  ├───────┼──────┼──────┼──────┼──────┤
  │   100 │  12ms│  14ms│  18ms│  17ms│
  │   600 │  61ms│  65ms│  72ms│  70ms│
  └───────┴──────┴──────┴──────┴──────┘

An HTML chart with avg, p95, min/max lines is written to ./results/index.html.

Use --json to get structured output for CI pipelines:

micron-runner --json > results.json

TypeScript

Types are included:

import Micron, { MicronConfig, BenchModule, BenchResults } from 'micron-runner';

License

MIT