Test: urlencode vs. base64_encode
Is urlencode() faster than base64_encode()
Run this test again Return to test menuResult: Discarded
The test labeled "urlencode()" was the faster by 0.0067 seconds, (0.635% faster)
The urlencode() test took 1.0445 seconds.
The base64_encode() test took 1.0512 seconds.
Nitty-Gritty
Each test case ran 20 random code order iterations consisting of 294,130 loops for a total of 5,882,600 runs.
- Line execution difference (0.000001) milliseconds.
- Avg difference (0.334) milliseconds per 294,130 loops.
- Total difference 6.67 milliseconds for 5,882,600 loops
The iteration variablity for Code 1 was (1.2591) milliseconds and Code 2 was (0.9958) milliseconds. The lower and the closer together there values are the more accurate the results are.
Code
The first test, "urlencode()", was:
$GLOBALS['dummy2'] = urlencode($GLOBALS['dummy']);
The second test, "base64_encode()", was:
$GLOBALS['dummy2'] = base64_encode($GLOBALS['dummy']);