mediawiki-extensions-Scribunto/includes/Engines/LuaCommon
theknightwho fc3104e9c6 Optimisations for mw.clone
`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
2024-05-24 02:08:41 +00:00
..
lualib Optimisations for mw.clone 2024-05-24 02:08:41 +00:00
HashLibrary.php Capitalise Engines folder 2022-09-30 00:58:27 +00:00
HtmlLibrary.php Capitalise Engines folder 2022-09-30 00:58:27 +00:00
LanguageLibrary.php LanguageLibrary: Ensure language code is a string 2024-04-11 16:20:24 +00:00
LibraryBase.php Replace some moved Title class uses, now MediaWiki\Title\Title 2023-08-19 12:22:05 +00:00
LuaEngine.php Use ObjectCacheFactory instead of deprecated ObjectCache method 2024-05-14 20:07:42 +00:00
LuaError.php Use namespaced classes 2024-01-05 19:24:06 +01:00
LuaInterpreter.php Capitalise Engines folder 2022-09-30 00:58:27 +00:00
LuaInterpreterBadVersionError.php Replace deprecated MWException 2023-06-09 14:43:44 +02:00
LuaInterpreterNotExecutableError.php Replace deprecated MWException 2023-06-09 14:43:44 +02:00
LuaInterpreterNotFoundError.php Replace deprecated MWException 2023-06-09 14:43:44 +02:00
LuaModule.php Use namespaced classes 2024-01-05 19:24:06 +01:00
MessageLibrary.php Update moved class RawMessage 2023-05-19 10:31:10 +00:00
SiteLibrary.php Replace global configuration variables 2024-03-18 04:40:44 +00:00
TextLibrary.php Replace global configuration variables 2024-03-18 04:40:44 +00:00
TitleLibrary.php TitleLibrary: Don't register external titles as dependencies 2024-04-10 11:32:44 -04:00
UriLibrary.php Add redirects for modules 2023-12-13 17:34:30 -05:00
UstringLibrary.php Add explicit parentheses around mixed boolean operator 2024-03-23 00:59:35 +01:00