PHP Benchmarks

Performance comparison of PHP code alternatives.

Result: Discarded

The test labeled "@ (shut up)" was the faster by 0.0384 seconds, (6.423% faster)

@ (shut up) 100%
without @ 93.577%

The @ (shut up) test took 0.5592 seconds.
The without @ test took 0.5976 seconds.

Nitty-Gritty

Each test case ran 20 random code order iterations consisting of 132,983 loops for a total of 2,659,660 runs.

  • Line execution difference (0.000014) milliseconds.
  • Avg difference (1.919) milliseconds per 132,983 loops.
  • Total difference 38.38 milliseconds for 2,659,660 loops

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

Code

The first test, "@ (shut up)", was:

@$GLOBALS['dummy']++;

The second test, "without @", was:

$GLOBALS['dummy']++;

Running: Linux (x86_64:1 GB) PHP (7.2.25-1+ubuntu16.04.1+deb.sury.org+1)