On Mar 9, 2015 1:24 PM, "Derick Rethans" <der...@php.net> wrote: > > On Fri, 27 Feb 2015, Xinchen Hui wrote: > > > Hey Internals: > > > > I was looking Bob's switch optimization.. > > > > then I start to worry about where is the place optimization should goes.. > > > > in generally, PHP is a interpreted language. IMO, it should > > compiler the PHP codes to opcode without any optimization(of course, > > we did some, but they won't change a lots of opcodes which should be > > generated).. > > > > and, since 5.5, we already have opcache bundled in.. > > > > thus, I am proposing a principle, that is: > > > > in the future, we only do optimization in opcache side, and keep > > Zend Compiler without any optimization... considering Zend Compiler do > > things in -O0. > > > > since, optimization always are dangerous.. if we only do them in > > opcache, user can still run them codes with disable opcache, or at > > least disable some optimization level which cause that.. > > > > what do you think? > > I think it's a very sensible approach. I would however like to see this > sort of 'experimental' optimisations to be also possible through an > extension. I think some of Sara's? AST hooks might help here?
AST may be siutable only for very basic optimisations. Opcache already implements optimisations on top of Control Flow Graph, but they take significant time. Without opcache they would slowdown execution instead of speedup. During work on JIT we developed a more smart framework for optimization based on Extended Static Single Assignment form. I think in the future we will able to get gain from it even without JIT. Thanks. Dmitry. > > cheers, > Derick