PHP Benchmarks

Performance comparison of PHP code alternatives.

Test: include vs. require

No Description

Run this test again Return to test menu

Result: Discarded

The test labeled "include" was the faster by 0.0541 seconds, (5.380% faster)

include 100%
require 94.62%

The include test took 0.9508 seconds.
The require test took 1.0049 seconds.

Nitty-Gritty

Each test case ran 20 random code order iterations consisting of 264,208 loops for a total of 5,284,160 runs.

  • Line execution difference (0.000010) milliseconds.
  • Avg difference (2.703) milliseconds per 264,208 loops.
  • Total difference 54.06 milliseconds for 5,284,160 loops

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

Code

The first test, "include", was:

clearstatcache();
include('./supplement/dummy.php');

The second test, "require", was:

clearstatcache();
require('./supplement/dummy.php');

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