Re: OOP Static Functions vs. Objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On May 1, 2006, at 3:53 PM, Richard Lynch wrote:

On Mon, May 1, 2006 8:25 am, Edward Vermillion wrote:
What I was mainly thinking of though, what kind of hoops does PHP
jump through to take a class, that I assume it's holding in memory,
and make an object out of it, aside from the constructor? Is it
doubling the memory consumption, or more, to do that by having the
class and an object ready to work on? Are objects stored differently
from included classes? Or is it treating it like object references(?)
and only making a copy when it's necessary? Or something else
entirely?

I don't know exactly how PHP handles a static function -- whether it
has a ghost instance laying around, or cached as needed, or maybe they
just fake it with a bogus object and call settype() on it a lot.

I don't think you need to worry about having a single "extra" instance
of every class.

You generally only get into trouble when you start building factories
churning out a zillion instances of some classes.

I think you'd have to REALLY work at it and screw up Design big-time
to get enough classes that the overhead of just the class itself would
take all your RAM.


I'm not worried so much with consuming all the resources at one time as much as just consuming too much and having the server bogged down if Brittany Spears decides to upload nuddie pics to one of my clients sites. ;)

I'm thinking, and I could be wrong about this, that the faster the script runs and the fewer resources it takes the more pages the server will be able to get out in a given amount of time. And I'd really hate to have a client call up and say that their server goes boink if a hundred folks decide to hit it at one time.

I guess really what I'll need to do is write it and then test it... and then write it again... what a pita... ;)

Thanks again all!
Ed

--
Like Music?
http://l-i-e.com/artists.htm



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux