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 "shell_exec()" was the faster by 0.0473 seconds, (4.652% faster)

shell_exec() 100%
system() 95.348%

The shell_exec() test took 0.9694 seconds.
The system() test took 1.0167 seconds.


Each test case ran 20 random code order iterations consisting of 229,479 loops for a total of 4,589,580 runs.

  • Line execution difference (0.000010) milliseconds.
  • Avg difference (2.365) milliseconds per 229,479 loops.
  • Total difference 47.30 milliseconds for 4,589,580 loops

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