Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Humanipedia
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:Timing/doc
(section)
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Testing with arguments === The test call can take additional arguments. It will pass those on unaltered to the function under test. Most important, they are ''not'' cloned, that is they are passed on as is, and therefore if the function under test alters them then errors will accumulate. This can happen for the types ''function'', ''table'', ''userdata'' and ''thread''. We don't use ''userdata'' and ''thread'' on Wikipedia. That leaves ''nil'', ''boolean'', ''number'' and ''string'' as passed by value and safe against changes. Strings are really pass by reference, but they are immutable and has copy on write. A common example on how to pass in an argument is how to do this for the current frame <syntaxhighlight lang="lua"> =require 'Module:Timing'(p.hello, mw.getCurrentFrame()) </syntaxhighlight> This produce the following output <pre> =require 'Module:Timing'(p.hello, mw.getCurrentFrame()) Each call was running for about 3.0e-09 seconds. Mean runtime for each set was 3.0e-07 seconds, with standard deviation of 2.0e-07 seconds, minimum 4.8e-06, maximum 5.2e-06. Total time spent was about 1.2e-04 seconds. Relative load is estimated to 1.1. </pre> Using arguments like this does not impose very much additional load, and most of it can be factored out.
Summary:
Please note that all contributions to Humanipedia may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Humanipedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)