Result: Discarded
The test labeled "Exceptions" was the faster by 0.0041 seconds, (0.371% faster)
The Exceptions test took 1.1112 seconds.
The return code test took 1.1153 seconds.
Nitty-Gritty
Each test case ran 20 random code order iterations consisting of 289,511 loops for a total of 5,790,220 runs.
- Line execution difference (0.000001) milliseconds.
- Avg difference (0.207) milliseconds per 289,511 loops.
- Total difference 4.13 milliseconds for 5,790,220 loops
The iteration variablity for Code 1 was (6.1199) milliseconds and Code 2 was (4.6634) 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']++; } }