Test: urlencode vs. urldecode
What is faster, encoding or decoding a URL?
Run this test again Return to test menuResult: Discarded
The test labeled "urldecode()" was the faster by 0.0258 seconds, (2.363% faster)
The urldecode() test took 1.0643 seconds.
The urlencode() test took 1.09 seconds.
Nitty-Gritty
Each test case ran 20 random code order iterations consisting of 283,255 loops for a total of 5,665,100 runs.
- Line execution difference (0.000005) milliseconds.
- Avg difference (1.288) milliseconds per 283,255 loops.
- Total difference 25.76 milliseconds for 5,665,100 loops
The iteration variablity for Code 1 was (6.2771) milliseconds and Code 2 was (3.9288) 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, "urldecode()", was:
$GLOBALS['dummy2'] = urldecode($GLOBALS['dummy']);