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

http://blog.timbunce.org/2008/07/12/devel-dprof-broken-by-the-passage-of-time/

and

http://blog.timbunce.org/2008/07/15/nytprof-v2-a-major-advance-in-perl-profilers/

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.

About these ads
This entry was posted in Computer and tagged , , , , . Bookmark the permalink.

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