A Cribsheet for Perl Profiling

A very brief post, capturing a crib-sheet of sorts on profiling with Perl for when I need it next. First, I’m using NYTProf, and huge props to the developers! Free Perl profiling is an absolute delight.

Second, all the info below can be drawn from that NYTProf link, but there’s a lot of verbage. So, here’s the absolute bare-bones essence of getting Perl profiling going with the module:

  1. Have NYTProf installed so Perl’s @INC array finds it (ActiveState Perl makes it dead easy with their package manager).
  2. Add a line to the opening preamble of the bootstrap perl file
    use Devel::NYTProf;
  3. Run the perl file from the command-line thusly:
    # perl -d:NYTProf bootstrap.pl
  4. Once finished, there will be a file called ‘nytprof.out’ in the same directory, which builds as the script runs. Use the following executable supplied with the module, to convert the raw output file to a richly-endowed set of web pages containing human-grokable profiler gold:
    # nytprofhtml
  5. This creates a directory ‘/nytprof’ in the same directory. Find the ‘index.html’ file inside it, and open it with your favourite web browser.
  6. Profit:
Sample NYTProf Results Screen

Sample NYTProf Results Screen

And here are some froody ideas around Perl efficiency once a bottleneck has been isolated.

On a side note, IDE support including breakpoint debugging, and now profiling. Punching Perl through the “just for glue” ceiling into “TISM” territory.

Think I’ll rename myself Greg and go hooning:

Advertisements

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