Ocean of Awareness

Jeffrey Kegler's blog about Marpa, his new parsing algorithm, and other topics of interest

Jeffrey's personal website

Google+

Marpa resources

The Marpa website

The Ocean of Awareness blog: home page, chronological index, and annotated index.

Thu, 17 Dec 2009


In Praise of NYTProf

I'd like to add my praise to the heap of it already piled onto NYTProf. This is a Perl profiler available on CPAN, with a very attractive HTML interface.

If you wait for your next efficiency issue before using NYTProf, you're making a mistake. For me optimizing is no longer NYTProf's primary purpose. NYTProf is a powerful debugging tool. The count of the number of times each line was executed yields marvelous insights quickly. Consider an example: a script to process a file. It is acting strangely. You don't know where to begin. Your test file is 1000 lines long. You notice certain lines in the per-line logic are not being executed 1000 times. Hmmm.

Simply checking for lines which are not executed at all is a surprisingly powerful technique. The HTML format allows you to skim the code, looking for these. This is particularly useful when the question is not localized or some matter of detail, but whether your overall logic makes sense, and whether your code actually implements the logic/algorithm you intended.

Adam Kaplan, Tim Bunce and Steve Peters, thank you.


posted at: 19:17 | direct link to this entry

§         §         §