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.0508 seconds, (8.252% faster)

shell_exec() 100%
system() 91.748%

The shell_exec() test took 0.5649 seconds.
The system() test took 0.6157 seconds.


Each test case ran 20 random code order iterations consisting of 130,511 loops for a total of 2,610,220 runs.

  • Line execution difference (0.000019) milliseconds.
  • Avg difference (2.540) milliseconds per 130,511 loops.
  • Total difference 50.81 milliseconds for 2,610,220 loops

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