Yes, someone will likely add it this time, since the compiler will be written in Perl and not macro-encrusted C. In addition, the compiler is being structured more like an ordinary compiler that separates compilation from execution with the express intention of allowing a better optimization pass in the middle when you aren't running in load-and-go mode. Plus the very fact that there's a switch statement will put people in mind to do it.
Your implication that 5.8.x does no optimizations that look beyond the current opcode is incorrect, or at least completely misleading. It would be more correct to say that it limits itself to optimizations on the current subtree and nearby opcodes. But it is correct insofar as it describes the idea that Perl 5 avoids expensive optimizations in the interests of starting up faster. Code movement optimizations tend to be expensive. (The switch optimization is not in fact such an expensive optimization, roughly O(n), I think, since it's scanning for linear consistency, and inserting an extra jump table opcode if it finds such a consistency. There are no stages where it compares everything against everything else.)
Anyway, if the switch optimization is so important to you that you are willing to sit there and snipe as AM, maybe you should add it yourself. :-) | [reply] [d/l] |