View example_bad.php
1 2 3 4 5 6 7 8 9 10
<?php
$client = new \GuzzleHttp\Client();
if ('production' !== getenv('APP_ENV')) {
$client->addSubscriber($logSubscriber);
$client->addSubscriber($debugBarSubscriber);
}
return $client;
View example_bad.php
1 2 3 4 5 6 7
<?php
return [
'key 1' => 'value 1',
'key 2' => 'value 2',
'key 3' => 'value 3'
];
View example_good.php
1 2 3 4 5 6 7 8
<?php
return [
'key 1' => 'value 1',
'key 2' => 'value 2',
'key 3' => 'value 3',
'key 4' => 'value 4',
];
View example_good.js
1 2 3
var angular = require('angular');
var bower = require('bower');
var gruntContribSass = require('grunt-contrib-sass');
View example_bad.js
1 2 3
var angular = require('angular');
var bower = require('bower');
var gruntContribSass = require('grunt-contrib-sass');
View example_bad.json
1 2 3 4
{
"key" : "value 1",
"changed_key": "value 2"
}
View example_good.json
1 2 3 4
{
"key": "value 1",
"changed_key": "value 2"
}
View results.md
Sending Request…

These are the results of my experiments using league/container to create 100k objects and calling 100k callables. When using no reflection, the container is first made aware of all the object/functions and their dependencies.

PHP Version Time creating objects (in ms) Time to call callables (in ms)
5.3.29 (no reflection) 2057 2957
5.3.29 (with reflection) 2297 3387
5.4.38 (no reflection) 1315 1906
5.4.38 (with reflection) 1396 2252
5.5.22 (no reflection) 1263 1825
View phpunit
1 2 3 4 5 6 7 8 9 10
vagrant@ubuntu:~/code/Proton$ vendor/bin/phpunit
PHPUnit 4.5.0 by Sebastian Bergmann and contributors.
 
Configuration read from /home/vagrant/code/Proton/phpunit.xml
 
Deprecated configuration setting "strict" used
 
...........
 
Time: 2.46 seconds, Memory: 7.25Mb
View index.php
1 2 3 4 5 6 7 8 9 10
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
require 'vendor/autoload.php';
$app = new Proton\Application();
$app->get('/user/{username}', function (Request $request, Response $response, $args) {
Something went wrong with that request. Please try again.