한국   대만   중국   일본 
Reddit - Dive into anything Skip to main content

Get the Reddit app

Scan this QR code to download the app now
Or check it out in the app stores

r/mediawiki

members
online

Welcome to /r/MediaWiki!

Performance of Lua+templates implementing MVC framework ? Performance of Lua+templates implementing MVC framework

I've implemented a few tools to help out my fellow authors over on https://hoodedhorse.com/wiki/Against_the_Storm/ , for example giving them easy-to-use templates to search the game data and display useful tables, infoboxes, etc. and to standardize the look and feel of the wiki.

I've implemented all of them so far exclusively in Lua with a MVC pattern except the latest, in which I moved the View component out of Lua and into templates. For example, to render a table of a particular dataset, the Controller concatenates the output from https://hoodedhorse.com/wiki/Against_the_Storm/Template:PerksCornerstonesTable/row for each row in the table. This is all instead of developing a separate View module in Lua as I've done in the past. It made it remarkably easier to write the tool! The tool's documentation is here: https://hoodedhorse.com/wiki/Against_the_Storm/Template:Perks

However, my plan to make the View much easier to author and maintain has backfired.

This latest tool is both the most data-intensive?with a full table containing 381 records?and the first to timeout on the server. The developer admins who generously host this wiki have increased our CPU execution time allowance, so it's not timing out anymore, but it's taking over 10 seconds to run the module and render the table. Here's a sample of the debug console from the Controller showing that each template takes between 20 and 40 milliseconds to for each line of Lua code that calls expandTemplate , and this is just for a table containing 81 records and still takes more than 2 seconds to load.

Is this expected performance of rendering a template?? Any suggestions?

local x = os.clock()
    local frame = mw.getCurrentFrame()
    frame.args["search"] = "food"
    local output = p.main(frame)
    mw.log("Output contains " .. #output .. " characters.") -- no actual output for this
    mw.log(string.format("Total elapsed time: %.3f\n", os.clock() - x))
expanding template for id='Accidental Crystalized Dew' elapsed time: 0.030
expanding template for id='Back To Nature' elapsed time: 0.020
expanding template for id='Skewers +2' elapsed time: 0.020
expanding template for id='Skewers +3' elapsed time: 0.030
expanding template for id='Pie +2' elapsed time: 0.030
expanding template for id='Pie +3' elapsed time: 0.020
expanding template for id='Pie +5' elapsed time: 0.030
expanding template for id='Biscuits +2' elapsed time: 0.020
expanding template for id='Biscuits +3' elapsed time: 0.030
expanding template for id='Biscuits 5pm' elapsed time: 0.030
expanding template for id='NeedPerk Biscuit Farmers' elapsed time: 0.020
expanding template for id='Biscuit Recipes' elapsed time: 0.020
expanding template for id='Eggs For Cysts' elapsed time: 0.020
expanding template for id='Cannibalism' elapsed time: 0.020
expanding template for id='[Altar] Cannibalism' elapsed time: 0.030
expanding template for id='Food Production For Engines' elapsed time: 0.020
expanding template for id='Accidental Pigment' elapsed time: 0.020
expanding template for id='Eggs +1' elapsed time: 0.020
expanding template for id='Eggs +2' elapsed time: 0.020
expanding template for id='Porridge Prod for water' elapsed time: 0.030
expanding template for id='Incense for Roots' elapsed time: 0.020
expanding template for id='Mushroom +1' elapsed time: 0.020
expanding template for id='Mushroom +2' elapsed time: 0.020
expanding template for id='Mushroom Specialization' elapsed time: 0.030
expanding template for id='Resolve for consumption' elapsed time: 0.020
expanding template for id='[Altar] Resolve for consumption' elapsed time: 0.020
expanding template for id='Vegetables +1' elapsed time: 0.020
expanding template for id='Vegetables +2' elapsed time: 0.020
expanding template for id='Grain Specialization' elapsed time: 0.020
expanding template for id='Grain 3pm' elapsed time: 0.020
expanding template for id='Grain 5pm' elapsed time: 0.030
expanding template for id='Root for every glade' elapsed time: 0.020
expanding template for id='Herbs 5pm' elapsed time: 0.020
expanding template for id='Insects 5pm' elapsed time: 0.020
expanding template for id='Insects +1' elapsed time: 0.030
expanding template for id='Insects +2' elapsed time: 0.030
expanding template for id='Insect Traps' elapsed time: 0.020
expanding template for id='Berries +1' elapsed time: 0.030
expanding template for id='Berries +2' elapsed time: 0.020
expanding template for id='Crops for Grain' elapsed time: 0.030
expanding template for id='Meat and Grain for Events' elapsed time: 0.020
expanding template for id='Meat 5pm' elapsed time: 0.030
expanding template for id='Meat Specialization' elapsed time: 0.020
expanding template for id='Grain +1' elapsed time: 0.020
expanding template for id='Grain +2' elapsed time: 0.020
expanding template for id='Mold Grain' elapsed time: 0.030
expanding template for id='Vegetables in Greenhouse' elapsed time: 0.020
expanding template for id='Mushrooms 5pm' elapsed time: 0.020
expanding template for id='Mushrooms in Farms' elapsed time: 0.030
expanding template for id='[Altar] Mushrooms in Farms' elapsed time: 0.020
expanding template for id='Eggs 5pm Stormbird' elapsed time: 0.020
expanding template for id='Meat +1' elapsed time: 0.040
expanding template for id='Meat +2' elapsed time: 0.020
expanding template for id='Wood +2 for insects' elapsed time: 0.020
expanding template for id='[Altar] Wood +2 for insects' elapsed time: 0.030
expanding template for id='Pickled Goods +2' elapsed time: 0.030
expanding template for id='Pickled Goods +3' elapsed time: 0.020
expanding template for id='Pickled goods 5pm' elapsed time: 0.020
expanding template for id='Fiber for Vegetables' elapsed time: 0.020
expanding template for id='Hostility for Sales' elapsed time: 0.030
expanding template for id='Porridge +2' elapsed time: 0.040
expanding template for id='Porridge +3' elapsed time: 0.040
expanding template for id='Roots 3pm' elapsed time: 0.040
expanding template for id='Roots 5pm' elapsed time: 0.020
expanding template for id='Accidental Jerky' elapsed time: 0.020
expanding template for id='Jerky +2' elapsed time: 0.020
expanding template for id='Jerky +3' elapsed time: 0.030
expanding template for id='Jerky +5' elapsed time: 0.020
expanding template for id='Herbs +1' elapsed time: 0.020
expanding template for id='Herbs +2' elapsed time: 0.020
expanding template for id='Herb Production for Biscuits' elapsed time: 0.030
expanding template for id='Roots +1' elapsed time: 0.020
expanding template for id='Roots +2' elapsed time: 0.030
expanding template for id='Accidental Lizard' elapsed time: 0.020
expanding template for id='Insects 5pm - Termite Nest' elapsed time: 0.020
expanding template for id='Food Production Speed +20' elapsed time: 0.020
expanding template for id='Food Production Speed +33' elapsed time: 0.030
expanding template for id='Insect for tree' elapsed time: 0.020
expanding template for id='[Altar] Insect for tree' elapsed time: 0.020
expanding template for id='Extra Prod for consumption' elapsed time: 0.030
expanding template for id='Accidental Skewers' elapsed time: 0.020
makeMarkupForTableRows elapsed time: 0.020
Output contains 42429 characters.
Total elapsed time: 2.120

Can Mediawiki receive emails and present them similar to a bulletinboard/'recent updates' ? Can Mediawiki receive emails and present them similar to a bulletinboard/'recent updates'
Editor support

As per title. Is there a way to create a bulletin board styled section on the main page? Currently I send out emails containing this information so ideally, sending them directly to the mediawiki server would be great to automatically populate this 'bulletin board' area. If there's something else that could be done in a similar way though, that would be great. I am open to ideas.