On Wednesday, Oct 22, 2003, at 16:57 US/Pacific, Tim Starling wrote:
This was acheived by eliminating redundant calls to secureAndSplit, using static variables for constants, and catering to PHP oddities such as the fact that === is slower than ==.
Okay, you may shower me with praise now.
*sprinkle sprinkle sprinkle* Three cheers for Tim!
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. 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. * '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
This is all "bug fixes" in stable... I've committed to cvs but haven't installed it just yet, but unless someone turns up problems in testing I'll install it tomorrow or so when I've got time to look it over and babysit the server for a while after it's online.
The new fixes will need merging into the dev branch along with all the other fixes...
-- brion vibber (brion @ pobox.com)