Extension:PhpTags/Performance

The PhpTags extension is designed to obtain the best possible MediaWiki extensions performance without using any additional components (only pure PHP code).

This is achieved by using the concept of Magic expressions instead of Magic words. Although PhpTags himself uses the technology Magic words, but it allows to reduces to a minimum overhead of usage other extensions.

Time that takes PhpTags consists of:
 * analysis of expression
 * execution of instructions
 * data transfer between extensions
 * time spent by the extensions

PhpTags works so rapidly that when used under the concept of the magic expressions the run time is negligible or it is not possible to measure.
 * The main part of the code should be in the extensions, and in the PhpTags placed instructions which features of these extensions, and in what order to use.

Of course, you can use this application as you wish, and in order to find out the effectiveness (as possible) this solution, I ran some tests.
 * All of these tests can give only a general overview of performance since they use completely different approaches and technologies.

Compared to Magic Words
For comparison I took two nested loops of 20 loops each, a total of 420 loops.

MediaWiki with PhpTags faster Magic words in more 86 times. ( 5.950 / 0.069 = 86.232 ) The next time bytecode will be taken from the cache, and PhpTags will be faster more 95 times. ( 5.950 / (0.069-0.007) = 95.968 )

Compared to pure PHP
For a more accurate measurement I increased the number of cycles up to 100100

The comments indicate the number of instructions that performs PhpTags.

Test Results: PhpTags: 11.462 secs PHP: 0.029 secs PhpTags/PHP: 394.573

As it can be seen PhpTags in this test is slower pure PHP almost in 400 times. But PhpTags has executed 1 302 005 instructions per 11.462 seconds and one instruction took the less 0.00001 second.

I'm sure PHP uses some hack for cycles, so I did another test where few cycles and a lot of code.

Test Results: PhpTags time usage: 0.332 sec Compiler: 0.272 sec Runtime: 0.060 sec Pure PHP: 0.00235 secs PhpTags/PHP without compiler cache: 0.332 / 0.00235 = 141 PhpTags/PHP with compiler cache: 0.060 / 0.00235 = 25

Well, something like that. Try not to use loops in PhpTags if you want to get the best performance.