PHP Benchmarks

Performance comparison of PHP code alternatives.

Test: system vs. shell_exec

No Description

Run this test again Return to test menu

Result: Discarded

The test labeled "system()" was the faster by 0.0497 seconds, (4.204% faster)

system() 100%
shell_exec() 95.796%

The system() test took 1.1325 seconds.
The shell_exec() test took 1.1822 seconds.


Each test case ran 20 random code order iterations consisting of 284,987 loops for a total of 5,699,740 runs.

  • Line execution difference (0.000009) milliseconds.
  • Avg difference (2.485) milliseconds per 284,987 loops.
  • Total difference 49.70 milliseconds for 5,699,740 loops

The iteration variablity for Code 1 was (7.2251) milliseconds and Code 2 was (9.4675) milliseconds. The lower and the closer together there values are the more accurate the results are.


The first test, "system()", was:


The second test, "shell_exec()", was:

echo shell_exec('ls');

Running: Linux (x86_64:1 GB) PHP (