If I understand what your saying, I think you'll get better mileage if you start with
profiling instead of
benchmarking:
- Benchmarking is best for deciding whether two or more ways of doing the same thing are significantly different in how long they take to do that thing -- it's the tool you use when you believe that a current implementation is taking too long and an alternate method should be quicker, because benchmarking will tell you whether your belief is justified.
- Profiling is best for dissecting the performance of a functioning script, in order to analyze where most of the time is spent; it's the tool you use to find out which segment(s) of your code (if any) will make the likeliest target(s) for optimization, because it doesn't make sense to optimize parts that are already pretty fast. Check "perldoc Devel::DProf" for more info on how to do profiling.
So if you do the profiling first, you'll have a better idea of which portions of code might need to be done some other way, and then you can benchmark the original and alternative methods for these portions to see whether the optimization works.