The performance gain from the constant pragma is never going to tip the balance in a real world application
One optimization alone is never going to tip the balance. but imagine how slow perl scripts would be if *everybody* thought like that.
i use a constant to switch on and off debugging in one of
my modules, and i
compared it to a normal variable, and the difference was
big enough for me to use a constant. and as i'm doing
benchmarks quite regularly i think i can estimate that.
i'm so tired of all the people saying "don't optimize
prematurely" while i have to use several awfully slow tools
at work. and slow forums like this one. yes, don't optimize too early, but do it at least at *some* point.
i just don't see why using a constant would be bad at all.
trading speed for maintainability is usually not worth it,
but what's wrong with a constant. just learn what you have
to do if you use it as a hash key and in strings, and that's it.
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.