Perl Monk, Perl Meditation | |
PerlMonks |
R (tilly) 3: Expand your worldby tilly (Archbishop) |
on Aug 20, 2000 at 11:30 UTC ( [id://28711]=note: print w/replies, xml ) | Need Help?? |
If you have a long list of arguments, it will be. First of all evals don't cost much more than just having had that much code in the first place. Secondly all of the evals take place up front. So it is just like having a longer program. But at runtime I have a hash lookup (constant time no matter how large the hash is) rather than repeated tests, So I have traded compile time away for faster run-time behaviour. FWIW I first realized the importance of this win when trying to speed up a program that categorized states into ACLI regions for a huge amount of text information. Just moving the logic out of if/elsif/elsif/else type constructs into hash lookups and/or smart REs was an order of magnitude improvement. Cheers, Ben
In Section
Cool Uses for Perl
|
|