Skip to content
/ Clutch Public
forked from pstora/Clutch

Clutch can make fight several PHP code to know which is the best in under certain conditions.

License

Notifications You must be signed in to change notification settings

aubryfr/Clutch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clutch Documentation

Clutch can make several PHP codes fight to know which is the best under certain conditions.

See Clutch for more info.

Disclaimer

This project is still a work in progress.

Introduction

"Don’t use symfony for your next «Hello World» website Use PHP ;) By the way, the fastest implemention of a Hello World application with PHP:"
<?php
die('Hello World');

-- Fabien Potencier @fabpot at Symfony Live 2009 Paris

Installation

Use Composer to install : free-agent/clutch.

Configuration

Create a competitions folder in your project. Inside it, create a bootstrap.php file and add a new namespace for the Competitions:

mkdir competitions
vim competitions/bootstrap.php
<?php

error_reporting(E_ALL);

$loader = require __DIR__.'/../src/bootstrap.php';
$loader->add('ClutchExample\Competitions', __DIR__);

Note

Replace ClutchExample by your projet namespace

Usage

To run a competition, simply run:

php bin/clutch fight ClutchExample/ArrayComparison

Note

Replace ClutchExample/ArrayComparison by your competition namespace

The output might be something like:

Welcome to the ArrayComparison competition !
Here are the competitors who will fight each others:
     - Array - The native PHP array
     - ArrayObject - The PHP array object

✭ Round 1: Int100Elements - Ready ? Fight !
     And the winner is...
     Chronometer (µs):
          1. Array with 2.8491020202637E-5 (±9.0599060058595E-6)
          2. ArrayObject with 4.0984153747559E-5 (±7.033348083496E-6)
     Memorymeter (bytes):
          1. Array with 544 (±0)
          2. ArrayObject with 576 (±0)

✭ Round 2: String100Elements - Ready ? Fight !
     And the winner is...
     Chronometer (µs):
          1. Array with 2.9850006103516E-5 (±1.3947486877441E-5)
          2. ArrayObject with 3.7384033203125E-5 (±4.5299530029295E-6)
     Memorymeter (bytes):
          1. Array with 544 (±0)
          2. ArrayObject with 576 (±0)

✭ Round 3: Object100Elements - Ready ? Fight !
     And the winner is...
     Chronometer (µs):
          1. Array with 0.00017499923706055 (±2.6464462280275E-5)
          2. ArrayObject with 0.00019152164459229 (±6.389617919922E-5)
     Memorymeter (bytes):
          1. Array with 848 (±0)
          2. ArrayObject with 864 (±0)

Thank you for watching us !

About

Clutch can make fight several PHP code to know which is the best in under certain conditions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 93.3%
  • JavaScript 6.7%