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

just-performance

v4.4.1

Published

Isomorphic ponyfill wrapping native browser performance and node.js perf_hooks performance

Readme

just-performance

CI

One performance import for Node.js and browsers. Write timing code once and use the platform's native performance object in each environment.

just-performance is a ponyfill: it exports an object without modifying globals. In Node.js, that object comes from perf_hooks; in a browser bundle, it is the browser's performance. There is no timer emulation or wrapper around each call.

Install

npm install just-performance

See CHANGELOG.md for packaging and compatibility changes.

Time an operation

import { performance } from 'just-performance';

const start = performance.now();
const sorted = [9, 3, 7, 1].sort((a, b) => a - b);
const elapsedMs = performance.now() - start;

console.log({ sorted, elapsedMs });

The same import works in Node.js ESM and browser code processed by a package-aware bundler. performance.now() gives a high-resolution timestamp in milliseconds relative to the platform's time origin. Measure elapsed time by subtracting timestamps from the same environment.

For CommonJS:

const { performance } = require('just-performance');
console.log(performance.now());

How resolution works

| Consumer | Export | | --- | --- | | Node.js ESM or CommonJS | Node's native perf_hooks.performance object. | | Browser bundle | The browser's native global performance object. | | TypeScript | Declarations selected for the corresponding Node or browser export. |

Node consumers get object identity, not a copy:

const { performance } = require('just-performance');
const { performance: native } = require('perf_hooks');
console.log(performance === native); // true

A browser needs a bundler that resolves package imports; this package does not make a bare npm import work in a browser without that tooling. The environment must already provide a native performance object. It does not fall back to Date.now().

Shared code and platform-specific APIs

Use common methods such as now() when sharing code. Node's additional fields and methods remain available to Node consumers, but they do not become browser APIs. The package does not normalize differences between the platforms or synchronize clocks across processes or devices.

For applications that run only in Node.js, importing performance directly from node:perf_hooks is also sufficient. This package is useful when the same source needs to target both environments.

TypeScript

import { performance } from 'just-performance';

const start: number = performance.now();
const origin: number = performance.timeOrigin;

Declarations ship with the package, including the required Node type dependency. NodeNext/Node16 consumers select Node declarations; a browser-oriented bundler configuration selects the browser declaration. The package tests verify both paths, including a browser type check without Node globals.

Development

Use Node.js 22 or newer:

npm ci
npx playwright install chromium firefox webkit
npm test

On Linux, Playwright may also require its system dependencies (npx playwright install --with-deps chromium firefox webkit).

The tests build and install the actual npm archive into an independent project, check CommonJS/ESM identity, compile Node and browser TypeScript consumers, and execute an esbuild bundle in Chromium, Firefox and WebKit. GitHub Actions runs the checks on Node 22, 24 and 26. Compiler caches are excluded from the archive.

npm pack builds the distribution; npm publish first runs the full test suite. Browser engines and the compiler are development tooling, not runtime dependencies.

License

MIT.