Redsandro
Redsandro

Reputation: 11356

Profiling Node.JS (code) execution time in Linux

I am looking for a method to do precise Node.JS profiling of script execution times on Linux.

There are interesting projects like the NodeTime.com Performance Profiler, but this profiles the timing of I/O httprequests and such, not execution time of lines of code.

I am looking for a way to figure out exactly where I can optimize my Javascript, where most of the time is spent, etc.


One interesting method I've seen is trying to create a FlameGraph using DTrace to profile Node.JS.

However, dtrace is very Solaris-specific.


How, in Linux, using the terminal or using Eclipse, can I profile the code of my Node.JS scripts? I'm looking for something specific like the Zend Profiler shows execution times of each command in code of PHP scripts.

Upvotes: 21

Views: 7644

Answers (3)

Ralph
Ralph

Reputation: 1679

https://www.npmjs.org/package/node.profiler Exactly what you need... It runs your project in monitor mode and it generates a chart after you are done with details on functions, each how many times it was called and the time it spent there.

Upvotes: 1

Bogdan Le
Bogdan Le

Reputation: 2276

"look" is a very good tool made by Vadim for profiling NodeJS app.

Take a look here:

https://github.com/baryshev/look

Upvotes: 8

brianreavis
brianreavis

Reputation: 11546

If you're not against using nodetime, it actually does have CPU profiling:

See: http://nodetime.com/blog/cpu-profiling-with-nodetime

enter image description here

Upvotes: 7

Related Questions