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.0345 seconds, (2.703% faster)

system() 100%
shell_exec() 97.297%

The system() test took 1.2434 seconds.
The shell_exec() test took 1.2779 seconds.


Each test case ran 20 random code order iterations consisting of 283,974 loops for a total of 5,679,480 runs.

  • Line execution difference (0.000006) milliseconds.
  • Avg difference (1.727) milliseconds per 283,974 loops.
  • Total difference 34.54 milliseconds for 5,679,480 loops

The iteration variablity for Code 1 was (6.2731) milliseconds and Code 2 was (12.6890) 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 (