<?php
/**
* Benchmarking include vs file_get_contents for serving
* static content.
*
* @author : Ed Cradock
* @require timer
*/

define('ITERATION_OFFSET'10000);

require_once 
'class/timer.php';

$timer = new timer();

/*
 * Time include
*/
$timer->start();
for(
$i 0$i <= ITERATION_OFFSET-1$i++)
{
   include 
'benchmark_include.txt';
}
$timer->finish();

$dump_include $timer->result();

// Reset the timer
$timer->reset();

/*
 * Time file_get_contents
*/
$timer->start();
for(
$i 0$i <= ITERATION_OFFSET-1$i++)
{
   echo 
file_get_contents('benchmark_include.txt');
}
$timer->finish();

echo 
'Benchmark of include : '$dump_include"\n";
echo 
'Benchmark of file_get_contents : '$timer->result(), "\n";
?>