Test: fcall vs. call_user_func
No Description
View test history (1) Run this test again Return to test menuResult: Saved
The test labeled "call_user_func()" was the faster by 0.007 seconds, (0.645% faster)
The call_user_func() test took 1.0808 seconds.
The fcall test took 1.0878 seconds.
Nitty-Gritty
Each test case ran 20 random code order iterations consisting of 295,269 loops for a total of 5,905,380 runs.
- Line execution difference (0.000001) milliseconds.
- Avg difference (0.351) milliseconds per 295,269 loops.
- Total difference 7.02 milliseconds for 5,905,380 loops
The iteration variablity for Code 1 was (3.4908) milliseconds and Code 2 was (3.5378) milliseconds. The lower and the closer together there values are the more accurate the results are.
Code
The first test, "fcall", was:
/* function do_something($i) { for ($i = 0; $i < 20; $i++) $GLOBALS['dummy'] + $i; } */ do_something(74);
The second test, "call_user_func()", was:
/* function do_something($i) { for ($i = 0; $i < 20; $i++) $GLOBALS['dummy'] + $i; } */ call_user_func('do_something', 74);