In addition to what the other monks have already said (maintainability, etc etc)
There are many variables and results can vary if you change any one, be it hardware, perl version/config, data, regex ... and your benchmarks should reflect that, so you can figure out whether its worth doing.
See two such benchmarks Re^3: Increasing the efficiency of a viral clonal expansion model, Re^4: Hamming Distance Between 2 Strings - Fast(est) Way?
See also, on benchmarking and (micro)optimizations, regex engine changes...
- http://perldoc.perl.org/perlvar.html#%24{^RE_TRIE_MAXBUF}
- speeding up a regex
- Regex combining /(foo|bar)/ slower than using foreach (/foo/,/bar/) ???
- /o is dead, long live qr//!
- Performance of possessive quantifiers
- How useful is the /o regexp modifier?
- Re^2: Never (qr//)
- Regexp::Assemble/Regexp::Trie/Regex::PreSuf
- Don't believe; measure.
- Why "Modern Perl" is slower than "Legacy Perl"?
- Perl regexp matching is slow??
- Perl Is So Slow, but Why?
- Why does a Perl 5.6 regex run a lot slower on Perl 5.8?
- Regexes are slow (or, why I advocate String::Index)
- Benchmarking regex alternation
- Benchmarking the basic operations
if you need to use Benchmark.pm
in order figure out which of two ways is faster, then it
probably isn't worth your time to be worrying about that
"optimization". Using Benchmark.pm is a good way to figure
out how much faster something is. --tye
- Making Programs Faster (Benchmarking, Profiling, and Performance Tuning)
- mod_perl: Performance Tuning
- CHAPTER 3 - Measurement Is Everything
"We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil." --Donald Knuth
- Re^2: How do I quickly strip blank space from the beginning/end of a string?
- Devel::NYTProf
- Optimising processing for large data files.
- Speeding up the DBI
- No More Meaningless Benchmarks!
- Mastering Perl: Benchmarking Perl Don't turn off your thinking cap
- Wasting time thinking about wasted time
- CPU cycles DO NOT MATTER!
- Performance, Abstraction and HOP
- Re^4: Performance, Abstraction and HOP