News Feed
Sections




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

Anthony Ferrara:
Is Autoloading A Good Solution?
July 20, 2012 @ 15:56:30

In his most recent post Anthony Ferrara takes a look at autoloading - mostly asking the question of whether the problems it has really outweigh the benefits.

The real problem that autoloaders solve is to load dependencies. [...] The normal logic that's used to justify autoloading over manual dependency loading in production is that it only loads the classes you need. Therefore you save the parsing costs of classes that you don't need. But surely that additional run-time loading has costs. So I decided to setup a test to see how expensive that additional run-time loading costs us, and to prove whether or not autoloading is worth it in production.

He gives an example of the two methods - using the spl_autoload_register method to define a loader and loading them with a defined file path instead. He found the autoloading version slower than the hard-coded (by quite a bit) but how, when the number of files is reduced, the performance gets much closer. He also briefly looks at two other pieces of file-related functionality: file_exists and require_once.

0 comments voice your opinion now!
autoload solution performance static path fileexists requireonce


blog comments powered by Disqus

Similar Posts

Joakim Nygard's Blog: Optimizing PHP Through Habits

Ed Finkler's Blog: Bug in Zend Studio 5.5ís php.ini

Brian Swan's Blog: Performance Tuning PHP Apps on Windows/IIS with Output Caching

PlentyofCode.com: J2EE vs ASP.NET vs PHP

Zend Developer Zone: George Schlossnagle Presents Talk on High Performance PHP


Community Events





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


bugfix introduction package podcast interview opinion laravel release voicesoftheelephpant zendserver api library symfony language community series unittest install framework deployment

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