Skip to content

Measure module loading and output a breakdown tree allowing you to spot your slowest modules/files

Notifications You must be signed in to change notification settings

danielkalen/module-timing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

module-timing

NPM NPM CircleCI

Measure module loading (aka require(...) calls) and output a breakdown tree allowing you to spot your slowest modules/files.

Usage

require('module-timing').start() // must call before any other modules

require('bluebird')
app = require('./app')
app.listen(80)

require('module-timing').end() // end tracking and print tree to console

Outputs: preview

API

.start()

Start tracking and measuring all subsequent require calls.

.end([options])

End tracking and print out breakdown tree to console.

options

Type: Object

slow

Type: number Default: 500

Threshold in ms to determine which files in the console output should be highlighted in red.

print

Type: boolean Default: true

If true then prints computed module tree to console. Otherwise, it simply returns the tree as a string.

depth

Type: number

Controls how deep the output tree should expanded to. By default, project files/modules will be expanded indefinetely while node_modules modules will stay un-expanded.

License

MIT © Daniel Kalen

About

Measure module loading and output a breakdown tree allowing you to spot your slowest modules/files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published