PHP Benchmarks

Performance comparison of PHP code alternatives.

Test: include vs. require

No Description

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

Result: Discarded

The test labeled "include" was the faster by 0.0099 seconds, (1.706% faster)

include 100%
require 98.294%

The include test took 0.5696 seconds.
The require test took 0.5795 seconds.

Nitty-Gritty

Each test case ran 20 random code order iterations consisting of 125,907 loops for a total of 2,518,140 runs.

  • Line execution difference (0.000004) milliseconds.
  • Avg difference (0.494) milliseconds per 125,907 loops.
  • Total difference 9.89 milliseconds for 2,518,140 loops

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