No description, website, or topics provided.
PHP
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Benchmark.php
README.md

README.md

Usage

Simple benchmark example, between the date() function and new DateTime::format() :

<?php

require 'Benchmark.php';

$bench = new Benchmark;

$bench->addTarget('function', 'date', array('Y-m-d'));

$bench->addTarget('object', function() {
        $date = new DateTime;
        $date->format('Y-m-d');
    }
);

$result = $bench->execute();

/*
 * var_dump($result) :
 *
 *   array (size=2)
 *     'function' => string '100%' (length=4)
 *     'object'   => string '122%' (length=4) 
 */