Result: Discarded
The test labeled "return code" was the faster by 0.0705 seconds, (10.330% faster)
The return code test took 0.6123 seconds.
The Exceptions test took 0.6828 seconds.
Nitty-Gritty
Each test case ran 20 random code order iterations consisting of 138,437 loops for a total of 2,768,740 runs.
- Line execution difference (0.000025) milliseconds.
- Avg difference (3.527) milliseconds per 138,437 loops.
- Total difference 70.53 milliseconds for 2,768,740 loops
The iteration variablity for Code 1 was (5.4709) milliseconds and Code 2 was (7.5229) milliseconds. The lower and the closer together there values are the more accurate the results are.
Code
The first test, "return code", was:
for ($i = 0; $i < 100; $i++) { if (return_false() === false) $GLOBALS['dummy']++; }
The second test, "Exceptions", was:
for ($i = 0; $i < 100; $i++) { try { throw_exception(); } catch (Exception $e) { $GLOBALS['dummy']++; } }