On Tue, Jul 21, 2009 at 8:31 PM, Matthew Weier
O'Phinney<[email protected]> wrote:
> -- Ed Lazor <[email protected]> wrote
> (on Tuesday, 21 July 2009, 11:03 AM -0700):
>> On Tue, Jul 21, 2009 at 10:48 AM, troels knak-nielsen<[email protected]> 
>> wrote:
>> > Irey<[email protected]> wrote:
>> >> That's a performance boost of 7X using a singleton versus not using a
>> >> singleton.
>> >
>> > You're conflating two unrelated concepts.  The performance difference
>> > that you observe is due to the difference between instantiating a new
>> > object per iteration vs. reusing the same.
>>
>> Isn't that one of the benefits of using a singleton?
>
> No, that's a performance benefit of re-using the same object. You can
> achieve the same benefit by passing the object in as a dependency to
> another object.
>

Speaking of "DI" (Dependency Injection), this is an interesting read:
http://www.whitewashing.de/blog/articles/118

Till

Reply via email to