I guess my point is that when you take that methodology to an extreme and make blanket statements about optimizing code you really just push the responsibility of the code performing well off to the next guy. I can think of 15 or 20 reasons why the OP would want to optimize the switch for best performance. I mean come on lets say you had a tight loop to pass chunks off a queue, a 50% or better performance boost would well be worth it. Sure, don't take optimization to an extreme and try to use the fastest print statement or whatever where id does not make a difference. I am just kind of sick of people jumping down on posters who ask about optimizations -- it seems many people here automatically think that ever question about them is mico-worthless-wastedtime-opimizations right off the bat. I know I have had many times where I have cut down the running time of my programs by 300 percent just by spending a few minutes looking at the core areas and optimizing. Hell look at
demerphq's phone prefix problem -- he cut off huge runtimes by changing the way he looked at data. At some point you as a programmer have to take the onus in your work to not toss code speed issues to the hardware guys just because you think your time is more valuable than cpu cycles. using your logic, I would have to see myself keep saying "where is that bubble sort sub I had sitting around here, Its easy for me to read/understand/maintain therefore i must use it unless I have damn good reason not to."
Bottom line is don't over optimize but don't be oblivious to easy readable optimizations.
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.