Brion Vibber wrote:
I've backported at least part of the changes to stable; it does make a difference. On a copy of [[List of China-related topics]], with 1994 broken links and 1 live one, the new code gives about a 15% increase in total page load speed -- which is a big difference considering that the page takes about 3.5 seconds to render on my 2GHz Athlon with a single request as the sole load! 16 of those page views in 60 seconds vs 70 seconds is a definite improvement. I'm sure there's more tweaking to be done...
(A note: when you're into this many links, the time it takes to load the info out of the link tables can actually be a significant chunk of the render time. More aggressive caching will hopefully render all this moot soon, though...)
Since I'm insane, I've also rewritten the replaceInternalLinks loop, which has been pissing me off for a long time. It now lets secureAndSplit do the link parsing rather than trying to do some of it itself, so the code should be easier to maintain.
That's good. I cut down the number of title-parsing operations from 4 or 5 to 2, and you got it from 2 to 1. It probably didn't impact on speed much because secureAndSplit is slower than the way replaceInternalLinks was doing it. Optimising secureAndSplit will now have a more pronounced effect.
Last night, I moved the first wfProfileIn to the top of Setup.php. It turns out loading code is taking about 30% of the profiled time (for [[Anime]] again). I was able to reduce that figure a little bit by making a few more files conditionally included. But my ISP is down so I couldn't commit it.
Maybe we should try PHPA:
http://www.php-accelerator.co.uk/
The rewrite doesn't seem to have made a significant impact on speed either way compared with my initial backport of Tim's bits, but the code's IMHO cleaner and I fixed some bugs while I was in there:
- initial spaces in the title of a link with a namespace are now
trimmed, so [[Wikipedia:_Oops]] now maps correctly to [[Wikipedia:Oops]] instead of generating a technically illegal title with initial whitespace in cur_title.
What about [[Wikipedia:__Oops]]?
- 'media' is treated as a localizable pseudo-namespace like 'special',
and can be adjusted in the language files
- media links should now go into the imagelinks table and show up in the
image backlinks
- on the off chance someone makes a link in the form [[:media:foo.jpg]],
the link won't turn into a misguided attempt to link to an article called "Media:foo.jpg".
- inline language links in the form [[:fr:lien interwiki]] finally work
- certain illegal links that were vanishing from the output completely
are now rendered as plaintext (such as "[[ ]]")
Another behavior change that could be changed back if people don't think it's a good idea:
- on links with the initial colon, the colon now isn't displayed in the
default link text
- 'class="internal"' removed from normal inline links, it just wastes
bandwidth without doing anything useful
All sounds good to me.
-- Tim Starling