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!
=== Testing a plain function === For example, assume we open a page [[Module:Example]], then we can write a call to profile the function p.hello(). The code in the page looks something like the example below, but local versions may be a little different. (At ''nowiki'' a similar code is at [[w:no:Module:HelloWorld2]].) The following code is a stripped-down version of [[Module:Example]]. See the page for a full version. <syntaxhighlight lang="lua"> local p = {}; p.hello = function( frame ) local str = "Hello World!" return str end return p </syntaxhighlight> Access to this code will be through a generic ''p'' in the debug console. Assuming the previous code the profiler can be called as <syntaxhighlight lang="lua"> =require 'Module:Timing'(p.hello) </syntaxhighlight> A call like that produced for the same type of module a report like the following at enwiki <pre> =require 'Module:Timing'(p.hello) Each call was running for about 1.2e-09 seconds. Mean runtime for each set was 1.2e-07 seconds, with standard deviation of 1.9e-06 seconds, minimum 8.9e-06, maximum 1.5e-05. Total time spent was about 2.5e-04 seconds. Relative load is estimated to 1.0. </pre> In this the important information is <samp>Each call was running for about 8.5120000000022E-9 seconds</samp>. This says how long the function actually run. Note that this function is very simple, and therefore the run time for the function gets close to the run time for the baseline. As a result, the run time for each set gets close to the standard deviation.
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)