Domas Mituzas wrote:
So, a checklist what can be done ( simple to complex )
[ ] - Simplification of {{cite}}
Short of significant improvements to the parser or requireing people to ask Domas before editing the template, I can
[ ] - Separate cache for Cite, to avoid reparsing on minor edits, that don't involve citations. I have no idea how much this would win, but there is theoretical chance of stripping 1% or so. ;) [ ] - Offload some templates like {{cite}} to actual PHP extensions (can of worms, but, oh well, can be standardized process too)
I've actually considered something like this in the past, basically creating a Cite 2.0 extension, where all the main cite options would be in the <ref> tags themselves with pre-defined "templates" written in PHP for web citations, book citations, etc.; this would greatly reduce the amount of stuff that needs to be done using the Cite wiki-templates and run through the parser.
You would have something like:
<ref author="Foo" title="Bar" type="book">Pages 1-10</ref>
Any parameters in the ref tag would be converted to HTML output using the "book" template in the extension rather than a thousand parser functions in some meta-template, and only the content of the tag (the page numbers in this case) would have to be run through the parser, so it would also be backwards-compatible with the current templates until they can all be migrated.
The main downside to this is that it requires someone to file a Bugzilla request every time a template needs changing.
[ ] - Implement proper scripting engine like Lua for metatemplates (http://pecl.php.net/package/lua
- another can of worms, though yet again, can be managed via trusted
set of people, on top20 wikis or so). [ ] - Frustrated operations guy adding something like ( return ""; ) in some random extension, and syncing the live hack. Obviously there would be some "HAHA YOU THOUGHT I COULDN'T DO THIS" comments in there.
I for one can directly participate in at least two of these options. ;-)
Unfortunately, {{cite}} is the only template I can profile/account for now, we don't have proper per-template profiling, but I wish to get one some day. Then we'd have more "war on ..." topics ;-D
Generally, templates are major part of our parsing, and thats over 50% of our current cluster CPU load. As we've actually managed to hit 100% last week, something what hasn't happened for a while, some of work has to be done here.
Of course, new hardware will help for a while, but I for one have huge personal satisfaction saving donation money. ;-)
CHEERS!