On 10/07/12 23:14, Daniel Kinzler wrote:
On 10.07.2012 13:58, Antoine Musso wrote:
Have you considered generating a PHP template and
just cache that? Then
all hits would be served directly by the very simple PHP template?
Could you elaborate on that idea? I'm not sure I fully understand what you are
suggesting.
I'm not sure if that is what he meant, but there exist an idea of
creating a new level of parser cache, so that when a page is parsed, the
parser would create and cache HTML template that is static, and a
mapping to non-static objects, and then when a local version is needed,
it would just replace the objects without recreating HTML.
So, for example, if you parse wikitext "Now is {{LOCALMONTHNAME}}", the
parser would produce something like "<p>Now is
f93c57b0-cb27-11e1-9b23-0800200c9a66</p>" (static template) and
f93c57b0-cb27-11e1-9b23-0800200c9a66 => "{{LOCALMONTHNAME}}" (mapping)
and then when a local version is needed just parse "{{LOCALMONTHNAME}}"
and insert in the template.
An additional advantage of this is that in addition to localized data it
could be applied to any separate textual block. So, for example, wikitext
"{{Infobox}}
Blah blah"
would actually be parsed like
"<p>f73d0fd0-cb28-11e1-9b23-0800200c9a66</p>
<p>Blah blah</p>"
f73d0fd0-cb28-11e1-9b23-0800200c9a66 => "{{Infobox}}"
And then when you change the template, it would be parsed and inserted
in all the articles it is used instead of completely reparsing every
article.
However a great problem with this is that the parser would have to
somehow be aware of when a piece of wikitext affects other wikitext and
when it does not. For example, it would somehow have to know that
something like
"{{Table start}}
||blah blah
{{Table end}}"
could not fit in the model and that these templates could not be
replaced with uuids.