PHP Benchmarks

Performance comparison of PHP code alternatives.

Test: include vs. include_once

No Description

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

Result: Discarded

The test labeled "include" was the faster by 0.0155 seconds, (1.551% faster)

include 100%
include_once 98.449%

The include test took 0.9861 seconds.
The include_once test took 1.0016 seconds.

Nitty-Gritty

Each test case ran 20 random code order iterations consisting of 266,262 loops for a total of 5,325,240 runs.

  • Line execution difference (0.000003) milliseconds.
  • Avg difference (0.777) milliseconds per 266,262 loops.
  • Total difference 15.54 milliseconds for 5,325,240 loops

The iteration variablity for Code 1 was (0.8037) milliseconds and Code 2 was (0.9856) 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.inc');

The second test, "include_once", was:

clearstatcache();
include_once('supplement/dummy.inc');

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