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

@satisfactory-dev/benchmark

v0.4.4

Published

A benchmarking library that supports high-resolution timers & returns statistically significant results.

Readme

Satisfactory.dev Benchmark.js Fork

Coverage Status Workflow Status

Forked from benchmark.js

Documentation

In a browser:

<script type="importmap">
{
  "imports": {
    "@satifactory-dev/benchmark": "../path/to/benchmark.js"
  }
}
</script>
<script type="module">
  import Benchmark from '@satifactory-dev/benchmark';
</script>

Using npm:

$ npm i --save @satisfactory-dev/benchmark

In Node.js:

import Benchmark from '@satisfactory-dev/benchmark';

Optionally, use the microtime module by Wade Simmons:

npm i --save microtime
import Benchmark from '@satisfactory-dev/benchmark';

function microtime() {
  const version = globalThis?.process?.version || '';
  if (
    version.startsWith('v21.') ||
    version.startsWith('v22.') ||
    version.startsWith('v23.')
  ) {
    console.warn('microtime appears to misbehave on node 21-23');

    return;
  }

  try {
    const result = require('microtime');

    console.log('using microtime');

    return result.now;
  } catch {
  }

  console.log('not using microtime');

  return undefined;
}

const maybe_microtime = microtime();

if (maybe_microtime) {
  Benchmark.Timer.changeContext({
    usTimer: maybe_microtime,
  });
}

Usage example:

var suite = new Benchmark.Suite;

// add tests
suite.add('RegExp#test', function() {
  /o/.test('Hello World!');
})
.add('String#indexOf', function() {
  'Hello World!'.indexOf('o') > -1;
})
// add listeners
.on('cycle', function(event) {
  console.log(String(event.target));
})
.on('complete', function() {
  console.log('Fastest is ' + this.filter('fastest').map('name'));
})
// run async
.run({ 'async': true });

// logs:
// => RegExp#test x 4,161,532 +-0.99% (59 cycles)
// => String#indexOf x 6,139,623 +-1.00% (131 cycles)
// => Fastest is String#indexOf

Bencher Integration

logger.js

import {
  bencherLogger,
  bencherReduction,
  extractStats,
} from '@satisfactory-dev/benchmark/integrations/bencher';

function reducer(was, stats) {
  was[`${stats.suite}::${stats.benchmark}`] = {
    hz: {
      value: stats.hz,
    },
    rme: {
      value: stats.stats.rme,
    },
    sample: {
      value: stats.stats.mean,
      lower_value: stats.sample.sort((a, b) => a - b)[0],
      upper_value: stats.sample.sort((a, b) => b - a)[0],
    },
  }

  return was;
}

async function* formatter(
  cycleFormatter,
  reducer,
  suiteSets,
) {
  for (const suites of suiteSets) {
    const result = await Suite.formatCycles(cycleFormatter, ...suites);
    yield bencherReduction(reducer, ...result);
  }
}

async function logger(suiteSets) {
  return bencherLogger(
    extractStats,
    reducer,
    formatter,
    suiteSets,
    process.stdout,
  )
}

export default logger;

example_perf.js

import Benchmark from '@satifactory-dev/benchmark';
import logger from 'logger.js';

// suite definitions goes here, pretend we have `const suites = [];`

// if one exports the suites, one can execute the benchmarks in batch
export default suites;

// if one checks to see if the file is called directly, one can execute just these benchmarks
if (process.argv[1] === import.meta.filename) {
  await logger([suites]);
}

Support

Tested in Tested in Chromium (143.0.7499.4), Firefox (144.0.2), WebKit (26.0), Node (20-25)