in reply to No More Meaningless Benchmarks!

You've rediscovered that moving around code is one way to optimize! I can imagine an optimizer that would take advantage of this, automatically permuting code to find more efficient variations. This is something like the approach used by ATLAS (Automatically Tuned Linear Algebra Software).

ATLAS is smart about not trusting something like the Benchmark module. I think it measures the results with a wall clock and will not compile if the system is otherwise busy. It takes a while to build.

This type of optimization is probably not a desirable way to mangle your perl source code except for fun, but it might be a great technique for optimizing something important like a regular expression engine. Of course it would not just move code around, the optimizer would explore the space of different buffer sizes, etc.

You can find ATLAS at I have used ATLAS in my projects and it worked great!

It should work perfectly the first time! - toma