NYTProf v2 – A better perl profiler

Back in August, I was profiling a perl script using Devel::DProf. As Tim Bunce suggested to me at that time, Devel::DProf was old and has some problems; and he has recommended NYTProf v2 as a replacement. I used NYTProf v2 to profile the same script. It helped me quickly pinpoint the bottleneck. This NYTProf v2 profiler is easy to use and has a very nice HTML report of subroutine-calls and times spent on each line/sub/module. For more information on NYTProf v2, you can read




Or sit back and watch http://blip.tv/file/1130150/.

I give the statistics below for the original version and the improved version of the script I was working on.

In the original script, some disk-reading code were called 29001297 times repeatedly, which significantly increased the running time. The script took few minutes to finish.

In the improved script, the disk-reading code was optimized – all the data was loaded at the beginning and stored in several hash variables. This largely reduced the total running time of the script.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s