Jaguard / time-require

Displays the execution time for Node.js modules loading by hooking require() calls
MIT License
253 stars 20 forks source link

show hierarchy #1

Open dylang opened 10 years ago

dylang commented 10 years ago

In this example:

a.js 1.1s
b.js 1s

The output does not tell us that b.js was required by a.js. That means it is not clear that 1 second of a.js is caused b.js, and speeding up b.js will in turn speed up a.js.

BTW - thank you for the github mirror. I wanted to create this ticket earlier but I've been too busy to set up a bitbucket account and figure out that service works.

cyparu commented 10 years ago

As you can see, requireHook deliver more relevant bits to the listener (parent, module, exports)... so we can definitely get more detailed info regarding the loaded module (parent, detection of internal Node.js modules require() => filename === name, exports ...etc).

If you have something in mind related to how the hierarchy view should show-up, fork & create a PR for this. Having kind of new CLI config like --show=tree|list(default) may be handy...

PS-1: requireHook will end up as a separate module (require-time-hook) since it may be useful in multiple scenarios (module profilers, static analyzers, dependency reporters ... etc). As a result, time-require will be just a user of this simple but I thing powerful new utility Node.js module.

PS-2: I'm using BitBucket because comparing it with GitHub, additionally supports Mercurial and UNLIMITED PRIVATE repositories (for individuals and for teams with less then 5 users). Since it is not so popular & social as GitHub, as a general rule I'll created associated mirrors on GitHub to support GitHub users as well.