News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
PHP Dependency Injection Container Performance Benchmarks
August 11, 2014 @ 10:15:14

The SitePoint PHP blog has posted the results of some dependency injection container benchmarks they performed on several different DI libraries, some from a few of the major PHP frameworks.

Most frameworks and larger PHP applications utilize a Dependency Injection Container with the goal of a more maintainable codebase. However, this can have an impact on performance. As loading times matter, keeping sites fast is important as ever. Today I'm going to benchmark several PHP Dependency Injection containers to see what their relative performance is like.

The libraries in their list of those tested include PHP-DI, Zend/Di and the Aura.Di component. They compare each libraries against the others based on execution time, memory usage and the number of files required to make things work. The results of each test are shown in the graphs on the rest of the post. It's also broken up into a few different kinds of tests:

  • Test 1 - Create an instance of an object
  • Test 2 - Ignoring autoloading
  • Test 3 - Deep object graph
  • Test 4 - Fetching a Service from the container
  • Test 5 - Inject a service

The results are pretty consistent across all of the tests with certain libraries always performing better than others....but you'll have to read the post to find out those request. The scripts that were used to get the various results are also shared on GitHub if you'd like to take them for a spin on your own.

0 comments voice your opinion now!
dependency injection benchmark performance container

Link: http://www.sitepoint.com/php-dependency-injection-container-performance-benchmarks/

blog comments powered by Disqus

Similar Posts

Kevin Schroeder's Blog: My first stab at the Dependency Injection Container in Zend Framework 2

Fabien Potencier's Blog: On PHP 5.3, Lambda Functions, and Closures

Martin Sikora's Blog: Storing arrays using JSON, serialize and var_export

Ian Selby's Blog: Put Your PHP App on Steroids - Optimizing with APC Cache

Marco Tabini's Blog: 5 PHP Performance Tips You Probably Don't Want To Hear


Community Events

Don't see your event here?
Let us know!


symfony2 framework version voicesoftheelephpant interview community php7 introduction release library performance series extension conference api example podcast laravel opinion install

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework