OSCON 2008: Ultimate Perl Code Profiling, by Tim Bunce
- Thu Jul 24 2008
- OSCON 2008
- Trackback URL
- comment feed
- digg this post
Tim Bunce is the author of the recently-released NYTProf v2.
I unfortunately missed the first five minutes of this seminar, as I was tied up giving an interview for O’Reilly News with chromatic. Tim, chromatic says hi and thank you for the help with XS.
NYTProf v2 does subroutine profiling, meaning it is a statement and a subroutine profiler, at the same time. The subroutine profile tracks time per calling location. It calculates exclusive time on-the-fly, and discounts the overhead of statement profile. To minimize disk I/O, it does everything in memory and writes to a file at the end. It’s also extremely fast. Statement profiler gives correct timing after leave operations.
v2 does sub microsecond resolution. It reports correct timing for mod_perl, handles forks with no overhead. Profiling can be enabled and disabled on the fly, and can profile compile-time activity.
When Tim asked for questions, Adam Kennedy asked, “The only question is, ‘Why are you so awesome?’”
The plan is to merge multiple runs, so say from running code through a test suite.
Reporting is only done via HTML or a CSV file. Tim isn’t too happy with this, thinking that he could come up with some pluggable class structure.
Trace file size depends on how long the profiler runs on your program. For example, running perlcritic on the NYTProf source code created a 360MB to profile 26 million statements. This ran for a minute and a half (which normally takes 30 seconds).
