Module:User/doc
This is the documentation page for Module:User
This module implements {{user}}. For documentation, please see the template page.
Technical details
[mali mi di yibu sheena n-niŋ]While the {{user}} template is only a wrapper for Module:UserLinks, by implementing it as a Lua module we make significant gains in performance. It is roughly twice as fast as accessing Module:UserLinks from wikitext. For example, this module rendered a test page containing nothing but 1000 {{user}} transclusions in 3.9 seconds, whereas the version that called Module:UserLinks from wikitext rendered it in 7.7 seconds.
The performance gains are achieved by reducing the number of parameters that are looked up from wikitext. In particular, the link codes, "t" and "c", along with the "span=no" option, are passed directly to UserLinks. Also, UserLinks looks up the arguments "user", "User", "project", "Project", "lang", and "Lang". From wikitext, each parameter is checked twice – once for the #invoke text and once for the calling template – and each check is relatively resource-heavy. From Lua, each parameter is only checked once, and the individual checks take much less time. This means that on average, maybe nine argument lookups are saved in each invocation by using this module. On pages with hundreds or thousands of invocations, this adds up to a lot of argument lookups saved.