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 🙏

© 2024 – Pkg Stats / Ryan Hefner

require-timer

v1.0.2

Published

Track and report module load times

Downloads

5

Readme

require-timer

Track and report module load times in Node.js

Synopsis

require('require-timer'); // output load timing information to stderr

require('require-timer')(process.stdout); // output load timing information to stdout

Description

This is a very simple module that instruments module loading to track how long it takes to require your modules. Intended to give data to help people improve the startup times of their command line tools.

Loading this module installs it globally, causing it to track load times across ALL calls to require. Obviously, if you've written your own module loader it won't instrument that.

Obviously it only instruments load times after its been loaded, so typically the first thing you do should be to load it.

Output occurs when the program exits.

Output

An example of the first few lines of running this on npm:

  295.038 msec from start,     1.542 msec to load: cli.js
    1.322 msec from start,     1.322 msec to load: cli.js -> require-timer
  294.891 msec from start,    35.301 msec to load: cli.js -> bin/npm-cli.js
   35.164 msec from start,     3.728 msec to load: cli.js -> bin/npm-cli.js -> npmlog
   34.485 msec from start,     1.189 msec to load: cli.js -> bin/npm-cli.js -> npmlog -> ansi
   34.131 msec from start,     0.205 msec to load: cli.js -> bin/npm-cli.js -> npmlog -> ansi -> lib/newlines.js
   44.787 msec from start,     1.529 msec to load: cli.js -> bin/npm-cli.js -> graceful-fs
   42.721 msec from start,     3.842 msec to load: cli.js -> bin/npm-cli.js -> graceful-fs -> fs.js
   44.564 msec from start,     1.278 msec to load: cli.js -> bin/npm-cli.js -> graceful-fs -> polyfills.js

The output is ordered by when the module began being loaded. That is, the output is in source code order.

The first number, is the amount of time into execution that this module COMPLETED loading.

The second number is how long the module took to load, not including the modules it loaded.

Finally, have the require stack:

  • Modules show up as just a module name (Note that they may have been loaded from a node_modules anywhere in your search path, this only shows you who asked for it, not where it was stored.)

  • Regular files show up as relative to the requiring module's root, so for example, when you see: graceful-fs -> fs.js this means that you'll find: node_modules/graceful-fs/fs.js. It's still the module's root even when it's a file doing the including, so for example, npmconf -> lib/load-prefix.js -> lib/find-prefix.js, load-prefix and find-prefix are in the same folder.