PHP Benchmarks

Performance comparison of PHP code alternatives.

Test: include vs. require

No Description

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

Result: Discarded

The test labeled "require" was the faster by 0.0376 seconds, (2.747% faster)

require 100%
include 97.253%

The require test took 1.3299 seconds.
The include test took 1.3675 seconds.

Nitty-Gritty

Each test case ran 20 random code order iterations consisting of 282,444 loops for a total of 5,648,880 runs.

  • Line execution difference (0.000007) milliseconds.
  • Avg difference (1.878) milliseconds per 282,444 loops.
  • Total difference 37.57 milliseconds for 5,648,880 loops

The iteration variablity for Code 1 was (9.4044) milliseconds and Code 2 was (11.0112) 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.22-1+ubuntu16.04.1+deb.sury.org+1)