PHP Benchmarks

Performance comparison of PHP code alternatives.

Test: rand more vs. less

No Description

View test history (1) Run this test again Return to test menu

Result: Discarded

The test labeled "less" was the faster by 0.0146 seconds, (1.331% faster)

less 100%
more 98.669%

The less test took 1.0848 seconds.
The more test took 1.0995 seconds.

Nitty-Gritty

Each test case ran 20 random code order iterations consisting of 277,126 loops for a total of 5,542,520 runs.

  • Line execution difference (0.000003) milliseconds.
  • Avg difference (0.732) milliseconds per 277,126 loops.
  • Total difference 14.63 milliseconds for 5,542,520 loops

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

Code

The first test, "more", was:

$GLOBALS['dummy'] = rand(0, 16384);

The second test, "less", was:

$GLOBALS['dummy'] = rand(0, 32);

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