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

perf-monitor-pro

v1.0.0

Published

A stylish performance monitor for catching slow functions in Node.js

Readme

Have you ever wondered why your API request takes 2 seconds to respond, but you don't know which function is causing the bottleneck?

perf-monitor-pro makes it incredibly easy to find slow functions. Just wrap a function or use the @monitor decorator. If it takes longer than your defined threshold, you'll see a beautiful warning in your terminal!


✨ Features

  • 🚀 Two Easy Ways: Use decorators for Object-Oriented code (@monitor), or wrapper functions (withMonitor) for functional code.
  • 🎨 Beautiful Developer Experience (DX): Colored, icon-supported logs only when a function exceeds the defined speed limit.
  • ⏱️ Zero Overhead on Fast Functions: If your function is faster than the threshold, it stays completely silent. No terminal noise!
  • 🤝 Works with Everything: Fully supports async/await, Promises, and synchronous functions automatically.

🎨 Terminal Experience

When a function takes longer than the threshold (e.g., 200ms), you get a clear warning. If it takes twice as long, it turns critical (red)!

⚠️ [perf-monitor-pro] Slow function detected: [Method] fetchUsers took 301.57ms (Threshold: 200ms)

🔥 [perf-monitor-pro] Slow function detected: criticalQuery took 501.09ms (Threshold: 100ms)

📦 Installation

npm install perf-monitor-pro picocolors
# or
yarn add perf-monitor-pro picocolors
# or
pnpm add perf-monitor-pro picocolors

Note for Decorator usage: If you want to use the @monitor decorator, ensure "experimentalDecorators": true is set in your tsconfig.json.


🚀 Usage Guide

Method 1: Using the @monitor Decorator (For Classes)

If you are using Classes, simply drop the @monitor decorator above any method.

import { monitor } from 'perf-monitor-pro';

class DatabaseService {
  
  // Warn if this method takes more than 200ms
  @monitor({ warnThreshold: 200 })
  async fetchUsers() {
    // some heavy operation...
    await db.query('SELECT * FROM users'); 
    return users;
  }
}

Method 2: Using the withMonitor Wrapper (For Standalone Functions)

For regular functions or arrow functions, just wrap them with withMonitor.

import { withMonitor } from 'perf-monitor-pro';

// Wrap your function and set the threshold as the second argument
const processPayment = withMonitor(async (amount: number) => {
    // some heavy operation...
    await stripe.charge(amount);
    return true;
}, { warnThreshold: 150 }); // Warn if exceeds 150ms

await processPayment(100);

⚙️ Options

{
  warnThreshold?: number; // The limit in milliseconds. Default is 200.
}

📄 License

MIT © Ahmet Ozcan