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

@workingmodel/why-is-this-slow

v1.0.0

Published

Tells you in plain English why your Node app is slow.

Readme

@workingmodel/why-is-this-slow

Tells you in plain English why your Node app is slow. Developed by Working Model.

npm version npm downloads license

CPU Bottleneck Report — server.js (10.1s sample)
────────────────────────────────────────────────────────────────────────

🔴  writeLog  src/logger.ts:14
   3.2s — called 4,100x — 31.4% of cpu
   Synchronous filesystem call on the hot path — blocks the event loop for every caller.
   → Replace with the async equivalent (e.g. fs.promises.writeFile) and await it.

🟠  getUserById  src/db.ts:42
   1.8s — called 220x — 17.6% of cpu
   Very high call count with non-trivial self-time — hot inner loop.
   → Profile the call site. Consider memoization, batching, or inlining the logic.

🟡  parseConfig  src/config.ts:8
   420ms — called 890x — 4.1% of cpu
   Meaningful CPU time spent here.
   → Review the implementation for unnecessary work, repeated computation, or missing caching.

Install

# Run once without installing
npx @workingmodel/why-is-this-slow node server.js

# Or install globally
npm install -g @workingmodel/why-is-this-slow
why-is-this-slow node server.js

Requirements: Node.js 18+. No other setup.


Usage

why-is-this-slow <command> [script] [...args]

Examples

# Profile a server for 10 seconds (default)
why-is-this-slow node server.js

# Profile a script that takes arguments
why-is-this-slow node scripts/migrate.js --env production

# Profile for 30 seconds
why-is-this-slow node server.js --duration 30

# Profile heap allocations instead of CPU
why-is-this-slow node server.js --memory

# Profile async I/O wait time
why-is-this-slow node server.js --io

# Save a flamegraph (opens in speedscope.app)
why-is-this-slow node server.js --flamegraph

# Machine-readable JSON output
why-is-this-slow node server.js --json > report.json

# Include node_modules frames (hidden by default)
why-is-this-slow node server.js --include-deps

Options

| Flag | Default | Description | |---|---|---| | --duration, -d <s> | 10 | Profile for this many seconds | | --top <n> | 10 | Show top N bottlenecks | | --memory | off | Profile heap allocations instead of CPU | | --io | off | Profile async I/O wait time instead of CPU | | --flamegraph | off | Save speedscope-compatible flamegraph to .wm-profile/ | | --json | off | Output machine-readable JSON | | --include-deps | off | Include node_modules frames (hidden by default) |


How it works

CPU mode (default) — Spawns your script with Node's built-in --cpu-prof flag (no native deps). After the duration, parses the V8 .cpuprofile and ranks frames by self-time. A heuristic rule engine matches function names against known bad patterns (synchronous I/O, blocking crypto, hot loops, JSON churn) and generates a plain-English explanation + fix for each.

Memory mode (--memory) — Uses --heap-prof to sample allocations. Reports the top allocating call sites by bytes, with rules for Buffer overuse, JSON parse allocation, and array spread patterns.

I/O mode (--io) — Injects perf_hooks observers and patches fs.readFile / fs.writeFile to measure async wait time. Reports the operations consuming the most I/O time.

Flamegraph (--flamegraph) — Writes a speedscope-compatible JSON file to .wm-profile/flamegraph.json. Drag it into speedscope.app for an interactive view.


Limitations

  • CommonJS only — the script must be runnable with node <script> (CJS). ESM scripts (type: "module") are not yet supported.
  • Short scripts — if your script exits in under ~1s, the profiler may not collect enough samples. Use --duration to match your script's natural runtime.
  • Memory mode accuracy — heap sampling is statistical. Low-allocation code paths may not appear in the report. Use --include-deps to widen the frame set.

Why This Exists

Every Node performance problem ends the same way: someone adds a console.log, stares at a flamegraph they can't read, or pastes an error into a forum and waits. The tools exist but they assume you already know what you're looking for. This one doesn't. You point it at your app and it tells you what's slow, why it's slow, and what to do about it — in plain English, with no setup.


More tools →

More tools from Working Model → workingmodel.co