Module talk:Delink
Appearance
Optimization of nested links
Hello,
When used many times in a page (several hundred times) this delink operation is quite long (several seconds), especially if text to delink is not short. To avoid the 10s limit for lua operation, I've tried to optimize it for French Wikipedia. My new version seams 4 to 10 times faster depending of string length.
Here are my modifications. I think the main effect comes from the way nested brackets are handled.
Please feel free to evaluate, criticize and/or use it.
Zebulon84 (talk) 09:07, 17 April 2014 (UTC)
- That's a neat trick! It's certainly better than the character-by-character concatenation mess that I created. We should be able to increase the performance further by using the Lua string library rather than the mw.ustring library where possible. Using mw.ustring has the drawback of having to cross back and forth between Lua and PHP all the time, which reduces the performance by quite a bit. Also, your version has some regressions in dealing with interwiki links, but that should be fixed easily enough. I'll have a look and see if I can improve it. Best — Mr. Stradivarius ♪ talk ♪ 14:51, 17 April 2014 (UTC)