Board Thread:Wiki Running/@comment-4189499-20150224012819

As has become apparent in recent days, Difficulty level as it currently stands is much too expensive. Now, I'm not talking about expensive in terms of money, because that makes no sense, but it takes a lot of resources to load it on a page as it must check the page name against each level to see if it matches. While this isn't a problem on most level pages, on pages where the template is used often, such as List of Levels, the template causes the page to load extremely slowly and prevents the whole page from loading and you end up with a node count limit error. Now, you don't need to understand exactly what a node count is, but every time the #switch in the Difficulty level template is used, each argument a level is checked against adds 2 to the node count, which means that Level 500 would have a node count of about 1,000. That's a lot!

The way to fix this is to change the way the template is set up to make it run faster, and the ideal way of doing that is to use Lua, a programming language recently added to Wikia. Now, I'm no good with Lua personally, but I asked around on Community Central and TJcool007 helped me out with creating the required modules. There will be no change to the output of the template, however the way in which the values are stored within the template are radically different, and much faster to load. It should also prevent those long level list pages from exceeding their node count limit, or at least they won't as quickly.

This change is going to happen, because this wiki desperately needs it, especially as more levels are added all the time. The final few parts of the modules are being fixed up now, and then it will be time to move them over here. I'll write a blog post before moving them, though, explaining how to update the difficulty level in these new template parts. On that note, any difficulty level which changes between about 12 hours ago and when the new templates are added won't be reflected in the new version of the template because the values have had to be re-added differently, so if any of the difficulties are changed, please keep a note of what they are and what they're being changed to so the new templates can be updated accordingly.

To the regular user, there will be no difference in the way that Difficulty level works. All these changes are purely back-end and have no impact on the result given out, apart from the fact that it should give that result much faster. 