-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Travis (wikiHow) wrote:
It seems part of our problem in Setup.php is the setting of function hooks. Just to clarify, this is the most efficient way to set a function hook, right?
$wgExtensionFunctions[] = 'wfWikiHowParserFunction_Setup';
function wfWikiHowParserFunction_Setup() { global $wgParser; $wgParser->setFunctionHook( 'ARTICLESSTARTED', 'articlesstarted'); $wgParser->setFunctionHook( 'PATROLCOUNT', 'patrolcount'); }
This will force $wgParser to be unstubbed at setup time. This isn't the end of the world, but it will have a couple of effects:
* If you don't have a working PHP opcode cache, this means that the big Parser class gets loaded whether you need it or not
* Actual parser object initialization happens whether you need it or not
* Parser initialization will be accounted in the extension setup phase in your profiling, which may skew the visible results.
In practice, this probably won't cause too much trouble. The parser is going to get unstubbed on just about any request that outputs HTML; it'll get used for UI message transformations even if you're outputting a page from the parser cache.
But for 304 "not changed" results, and potentially for some API hits and stuff, it might shave off a few milliseconds to be able to skip it.
To do that, you want to call setFunctionHook() from a parser first call init hook, as currently done by a lot of our extensions, as mentioned in my last post in this thread.
- -- brion