Thank you guys, your comments are enlightening.
My suspicion about performance is in fact about database. Here is an
example,
$user->getUserData(1,'name');
function getUserData($idUser, $key) {
// if $this->userData[id] exists return it
// else
// connect database and get some data
// store it in the object - $this->userData[$idUser];
}
I call this and similar methods many times in a request. Instead of calling
it from db each time I store it in the object. But creating many instances
avoid this.
My concern about performance is all about this.
I always try to minimize database connections and queries. I think this is a
good approach for using resources efficiently (Maybe I exaggerate this I am
not sure)
Any comments are welcome.
On Mon, Nov 29, 2010 at 6:05 PM, Bill Karwin <[email protected]> wrote:
>
> On Nov 29, 2010, at 6:28 AM, Serkan Temizel wrote:
>
> Making it singletone, I think will improve performance but can't figure
>> out
>> drawbacks.
>>
>
> You should take profiling measurements to support this assumption, instead
> of guessing that the creation of six objects instead of one object is really
> the greatest bottleneck in your application. Hint: it's probably not.
>
> When it comes to performance, don't be penny wise and pound foolish. Focus
> on your application's areas of greatest performance cost before giving
> attention to micro-optimizations.
>
> Regards,
> Bill Karwin
>
>