When compiling PHP code, there are a lot of constants that are used for lookups and are stored in opcodes. I wonder why the engine won’t precalculate hashes and store them? OK, PHP 5.1 has CVs, which does it for variables. But there are also classes, functions, constants. This would, of course, make some parts of the engine code more complicated since we may deal with non-constant call too, in which case the hash won’t be pre-calculated, but it still can be done I think. On top of that, due to the fact that classes and functions are case-insensitive, a lot of lowercasing is going on too, which might be saved too.


One thought on “Optimizations?

Comments are closed.