Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Timing/doc
(section)
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!
====Wrapper in the debugger ==== The wrapper function can de defined in the debugger, that is added in the text area for debugging. Add a separate function like the following <syntaxhighlight lang="lua"> function wrap() return p.hello(mw.getCurrentFrame()) end =require 'Module:Timing'(wrap) </syntaxhighlight> A call sequence like that produced the following output <pre> function wrap() return p.hello(mw.getCurrentFrame()) end =require 'Module:Timing'(wrap) Each call was running for about 1.9e-07 seconds. Mean runtime for each set was 1.9e-05 seconds, with standard deviation of 3.4e-07 seconds, minimum 6.7e-06, maximum 7.3e-06. Total time spent was about 3.7e-04 seconds. Relative load is estimated to 3.7. </pre> Note that the duration of the call is much higher than the bare function itself! The inspected function must be a bit heavy, otherwise the wrapper will dominate the result. An alternate form with an anonymous function is <syntaxhighlight lang="lua"> =require 'Module:Timing'(function() return p.hello(mw.getCurrentFrame()) end) </syntaxhighlight> In general you should precompute as much as possible to avoid unnecessary computations inside the loop, like this <syntaxhighlight lang="lua"> my_frame=mw.getCurrentFrame() =require 'Module:Timing'(function() return p.hello(my_frame) end) </syntaxhighlight>
Summary:
Please note that all contributions to Stockhub 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
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)