Profilers or more specifically NYTProf
So we took a look at the module that does the calculation. First off, it was a little long (four thousand lines,) so just eyeballing it wouldn’t easily point us to what was causing the slowdown. Fortunately my coworker Neil, who wrote the module, had also written a simple to execute perl script, as opposed to everything being in a cgi script. So with that in hand, we fired up NYTProf.
NYTProf is a profiler that was written for use at the (wait for it) New York Times. After installation using it was extremely easy:
perl -d:NYTProf calc.pl
That generates a database of what went down. Next we ran:
Anyway, if you find yourself hitting a speed wall, NYTProf isn’t hard to use at all. The only problem you may run into is not having a simple to run test script. This is another reason to split business logic into modules; you can easily use the modules in your controllers, test scripts, and profilers.
Have fun!Posted Tue, May 12, 2009
If you're interested in being notified when new posts are published, you can subscribe here; you'll get an email once a week at the most.