Module:Timing/doc: Difference between revisions

Content deleted Content added
amp?
m Typo fixing, replaced: occurences → occurrences, typo(s) fixed: As a result → As a result,, ie. → i.e. , stripped down → stripped-down
Line 1:
{{Module rating |beta<!-- Values: pre-alpha • alpha • beta • release • protected -- If a rating not needed/relevant, delete this template call -->}}
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. -->
The purpose of this module is to provide a simple method to do timing analysis for [[w:en:performance tuning|performance tuning]] of Lua-functions, that is [[w:en:Profiling (computer programming)|profiling of functions]]. Usually measuring the duration of function calls is part of a larger effort to identify bottlenecks and problematic code. This is not a full-blown profiler, as it is not possible to do line-tracing (call-graph profiling) in the current set up. Its only purpose is to measure execution time (flat profiling), and to do this interactively from the debug console (iei.e. on a single function).
 
''As it is said several times in this text; the timing is not accurate and it should only be used as a coarse measure of the approximate run time and load of a function. Do not attempt to fine-tune a module to just fit into the maximum allowed time slot for a module, keep well below the limit!''
Line 17:
For example, assume we open a page [[Module:HelloWorld]], 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:HelloWorld]]. See the page for a full version.
<source lang="lua">
my_object = {};
Line 49:
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.
 
=== Testing with arguments ===
Line 211:
* [[w:en:Average]] ''The code use an arithmetic mean''
* [[w:en:Standard deviation]] ''The code use variance and standard deviation''
* [[w:en:Sum of normally distributed random variables]] ''The code makes an assumption that delays are independent random occurencesoccurrences, which is not quite right''
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||