I'd like to write a Meditation on Perl optimization and profiling. I don't see too much discussion here about it, and I feel it's something that might be of interest.
Given that I can edit this node later, I figure I'll first ask for some sample code to use as an example. I'd like someone to point me to or send me a Perl application that:
- is something they wrote
- is not a CGI or database app
- has a moderate number of subroutines, rather than one big blob of code in main
- has not yet been optimized
- runs slowly enough to actually time
- is not destructive to data
- does not require more than 1Mb of disk space to run
My strategy will be to optimize the code step by step, detailing the process and code changes, and showing the resultant speed increase (or memory reduction)
Thanks!
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|