mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-12-11 16:06:02 +00:00
fc3104e9c6
`mw.clone` is called on the global table for each new `{{#invoke:}}`, which is a major contributor to loading times on large pages. This change introduces various speed optimisations that make it around 15% faster: * `recursiveClone` is declared outside of the main function, to avoid generating a new closure each time `mw.clone` is called. * This means `tableRefs` has to be passed as an argument to `recursiveClone` instead of being an upvalue, which also decreases access time. * `recursiveClone` is only called after a `type` then `tableRefs` check confirms a value is an unseen table, meaning it's only called when needed, not for every key/value pair (which add noticeable overhead when cloning large tables). * `getmetable` is only called once, not twice, by using a local variable. * `tableRefs[elt]` is only accessed once, by using a ternary operator. * Any global accesses have been replaced by local ones. Bug: T357199 Change-Id: I51593a971f0be728255723ca300d1ce692ead256 |
||
---|---|---|
.. | ||
luabit | ||
ustring | ||
bit32.lua | ||
libraryUtil.lua | ||
mw.hash.lua | ||
mw.html.lua | ||
mw.language.lua | ||
mw.lua | ||
mw.message.lua | ||
mw.site.lua | ||
mw.text.lua | ||
mw.title.lua | ||
mw.uri.lua | ||
mw.ustring.lua | ||
mwInit.lua | ||
package.lua | ||
strict.lua |