Perl profiling with Devel::NYTProf (the Perl profiler)

Devel::NYTProf - Profiling Perl code

Speeding up your code with a feature-rich code profiler

Perl is fast, but how much faster could your Perl code be?

Finding those bottlenecks can be hard, or rather that was the case until Devel::NYTProf the modern Perl profiler.

Initially developed by Adam Kaplan at the New York Times, this module has been evolved by Tim Bunce into a phenomenal statement and a subroutine profiler. With multiple output formats from HTML reports (richly inter-linked annotation of source code, plus sortable columns and interactive treemaps of subroutine times) to KcacheGrind interactive graphical call graphs, tracing those bottlenecks is easy.

Running your code through this Perl profiler will identify which subroutines (and statements) are taking the longest or being called the most, which code is calling that subroutine and how many times. With such fine grained information available it is easy to locate and improve the performance of your code. Devel::NYTProf makes exploring the behaviour of your code so interesting that you might find it hard to know when to stop. That's one thing it won't tell you.


  • "What can I say - the best profiler ever. I've used profilers in other languages as well as Perl, and nothing makes finding hotspots as painless and as much fun as Devel::NYTProf" - Mark Aufflick
  • "This module rapidly became an indispensible part of my devel toolkit, and each new release brings some new feature that has you wondering how you managed without it." - Sam Graham


Article Author

Leo Lapworth