On Thu, 04 Apr 2013 13:57:42 -0700, vitalif@yourcmc.ru wrote:
I second that!
Also I have an idea: maybe it would be good for mediawiki it the "initialisation state" along with all constants/global variables/extension metadata/preinitialised parser/preloaded PHP files, could be cached somewhere as the whole and just loaded on each request instead of being sequentially initialised? (extension metadata = hooks/special pages/i18n files/resource modules/credits/etc) If it's a good idea then I think sequential setting of hooks via a method call is not that good? (because hooks become even less "declarative"?) Or it's not worth it and the initialisation overhead is small?
You can't cache program state and loaded code like that in PHP. We explicitly have to abuse the autoloader and develop other patterns to avoid loading unused portions of code because if we don't our initialization is unreasonably long.
In other languages of course like python and ruby. The application runs more like a daemon. Initialization can be done once when the program starts up. Then many requests are handled by the same process. But PHP pretends to be CGI even when not CGI.
HipHop is an improvement. But we're not quite there yet and most people probably won't try using it or need it.