|
Sign In/My Account | View Cart | |||||||
|
||||||||
Where 2.0 Conference June 13-14, 2006, San Jose, CA |
|
A Timely Startby Jean-Louis LeroyDecember 21, 2005
In the first case, I explained how I had rewritten a heavily used Korn shell script in Perl, in the process bringing its execution time from a half-hour down to ten seconds. The audience laughed and applauded loudly at that point of my talk. Then I proceeded to the second case, where the situation was not so rosy for Perl. One of my colleagues had rewritten a simple Slower?My job was to investigate. I found a couple of obvious ways of speeding up the Perl script. First I removed hidden calls to subprocesses:
Then I replaced a few Take this code:
This loads Pod::Usage, even if
This just gives the illusion that the program loads
After these changes the situation had improved: the Perl version was only five times slower now. I pulled out the profiler. Sadly, most of the time still went to loading modules, especially Net::FTP. Of course, we always needed that. If you dig in, you realize that
This is not by itself a bad thing: modules are there to promote code reuse, after all, so in theory, the more modules a module uses, the better. It usually shows that it's not reinventing wheels. Modules are good and account for much of Perl's success. You can solve so many problems in ten lines: use this, use that, use this too, grab this from CPAN, write three lines yourself--bang! problem solved. |
Sponsored By: |
Contact Us | Advertise with Us | Privacy Policy | Press Center | Jobs | Submissions Guidelines Copyright © 2000-2006 OReilly Media, Inc. All Rights Reserved. |