News Feed
Jobs Feed
Sections




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

Doru Moisa's Blog:
Static call versus Singleton call in PHP
March 01, 2010 @ 21:22:57

Doru Moisa has written up a new post with some benchmarks comparing static calls versus singleton calls for a few different situations.

n the past several months I've been working with a rather large application built with symfony. I noticed that symfony makes heavy use of the Singleton pattern (other frameworks, like Zend do that too); everywhere in the code [...] Notice the amount of code needed by the Singleton pattern. Except the [shown] method, all the code in the class makes sure you have only one instance at any time during the execution.

He shows how to replace the standard singleton logic with something more specific and decides to test the two methods, seeing which of them can handle the most requests per second. His sample code is included for both the scripts called and the test script run. In all instances, the static call won out over the singleton instance easily. Even when tested with the Facebook compiler, the results were still the same.

0 comments voice your opinion now!
static singleton benchmark hiphop


blog comments powered by Disqus

Similar Posts

Community News: Seven PHP Projects Finalized in Google Summer of Code 2009

Sebastian Bergmann\'s Blog: PHP 5.1 / GCC Benchmark (Update)

Padraic Brady's Blog: Zend Framework Caching (Parts 1, 2 & 2b)

Alvaro Videla's Blog: Erlang as a Fast Key Value Store for PHP

Gonzalo Ayuso's Blog: PHP Template Engine Comparison


Community Events











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


package database opinion symfony2 introduction language facebook hhvm application component unittest overview framework podcast performance composer release hack install security

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