Re: OOP Static Functions vs. Objects
| From: | Edward Vermillion | Date: | Mon, 01 May 2006 22:37:29 +0000 |
| Subject: | Re: OOP Static Functions vs. Objects | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235220@lists.php.net to get a copy of this message | ||
On May 1, 2006, at 3:53 PM, Richard Lynch wrote:
On Mon, May 1, 2006 8:25 am, Edward Vermillion wrote: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! EdWhat 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.
--Like Music? http://l-i-e.com/artists.htm