Content deleted Content added
No edit summary |
|||
Line 1:
:''Note that the module is not ready for production, it is still under (somewhat) active development!''
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
The
The profiler does two passes over the total calls, one with a dummy function and one with the actual function. This makes it possible to get a baseline for how heavy the additional code are, and then we can later subtract this from the measurement of the function we are testing. If the function under test is to simple those to execution times will be close and the uncertainty in the difference can be high. If the execution time is similar to the standard deviation, then the
During development it became clear that 100 calls in 10 sets is usually enough to get good estimates, but do not put overly much weight on those numbers. If one function is twice, or tree times, or even ten times slower, never mind as long as it runs in constant or linear time. If something is 100 times slower or have indications that it runs in exponential time, then you should probably consider other algorithms.
Line 25:
<source lang="Lua">
=require 'Module:
</source>
Line 31:
<pre>
=require 'Module:
Each call was running for about 6.20966E-9 seconds. Mean run time for each set was 6.20966E-6 seconds,
with a standard deviation of 5.6091767397007E-6 seconds. Total time spent was about 0.010717389 seconds.
|