(Besides practice)
Specifically, I feel like I'm missing intuition in my optimization procedure. Here's what I do:
- Decide what is the bottleneck either via profiling or guesswork.
- Pick the specific operations that are causing the most grief, and think up better ways to accomplish the same goals.
- Try some solutions, benchmarks are often involved.
Step 2 has some serious voodoo in it. Not good voodoo, bad voodoo. When I program in C, my guesses as to what needs to change and how to change it are pretty good. When working with Perl, I'm often shocked by which solutions perform faster, which is telling me that I've got a really poor mapping in my mind between operations in Perl and how much effort Perl exerts to accomplish them.
I don't feel like practice is teaching me much in this regard; I just end up confused as to why X is faster than Y. When perl is not quite fast enough's "What causes slowness in Perl" section has been a good resource for me, but I'm looking for more. Are there other resources out there (I've got the camel and the cookbook on my desk, as far as texts go) that would help wrap my head around this better? Reading posts around PerlMonks that optimize others' code make me really wish I was better at this.
Thanks in advance, and have a great thanksgiving if you are a thanksgiving-celebrating-monk.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.