So I wrote a tool to provide this information. I present to you:
https://www.npmjs.org/package/require-timer
Once loaded it tracks all require calls (including the one to load itself) and then, after your program completes, prints out a report to stderr (or whatever stream you specify). The report tells you what led to each module being loaded, when it was loaded and how long it took to load (not including the modules it loaded).
So, for example, the first few lines from running it 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
Cheat sheet: The order is the order requires were called. The first number is when the rquire finished and the second number is how much time was spent doing stuff in that module besides loading other modules.
(It's implemented by hooking the now deprecated require.extensions, but its done in such a way that it's unlikely to run into anything *too* weird.)
-- Rebecca
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/etPan.53df23df.66334873.ec1b%40sierra.
For more options, visit https://groups.google.com/d/optout.