Content deleted Content added
No edit summary |
|||
Line 9:
==Usage==
This module is not for use in ordinary templates, or on pages, it is to be used in the debug console below the edit window on module pages. For use of the module in a sandboxed environment, look further down.
=== Testing a plain function === 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.
Line 44 ⟶ 47:
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 a wrapper function ===
If a call need some parameters, then those most be provided in a wrapper function. That can be achieved by adding a separate function like the following, and then timing the resulting function
Line 94 ⟶ 98:
The morale is; do not add wrappers to very simple functions, the numbers will be far off! ;)
===Testing in a sandboxed environment===
==Gadget==
|