Re: [PHP] PHP's OO is bad?
I did some benchmark on how fast variable access is when being used through OOP. And this difference can be up to 1,7 times as slow. I surely hope you can speed up, right now I'm not using it because it's slower... Zef Phil Driscoll <[EMAIL PROTECTED]> schreef in berichtnieuws [EMAIL PROTECTED] > On Sunday 13 May 2001 06:25, Sean Cazzell wrote: > > certainly not the "signigicant slow > > down" that he claims. > > > I don't know whether or not what Sterling said is true, but I think that your > comment that the difference in speed with a larger program would be less is > incorrect in view of your benchmark. Your test does so little that I would > imagine that the bulk of the execution time is taken up just by the > initialisation and closedown of the request (by browser, apache and php) and > the time taken in transit. It *could* be that the OO stuff executed many > times more slowly than the non-OO. > > > Cheers > -- > Phil Driscoll > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP's OO is bad?
Zeev wrote: > Using OO usually results in a significant slowdown. Significant doesn't > necessarily mean 50% performance drop; 5% to 20% is not uncommon, and as > you said, YMMV. > This is certainly in line with my own real-world tests. I suspect that in most applications, much the largest overheads are parsing the scripts (unless you are using Zend cache or APC) and database calls. On my application, the few milliseconds of processing time lost by going with OOP are insignificant compared with these - processing time is simply not the bottleneck. On the other hand, well designed OOP can offer significant gains in maintainability and reusability with complex applications... Geoff Caplan Insight Professional -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP's OO is bad?
Using OO usually results in a significant slowdown. Significant doesn't necessarily mean 50% performance drop; 5% to 20% is not uncommon, and as you said, YMMV. We're working on ways to improve the OO performance, but it's pretty difficult, due to the very dynamic nature of PHP. Zeev At 08:25 13/5/2001, Sean Cazzell wrote: >His series of articles ("top php programming mistakes") is great, and >I've heard good things about his "PHP Cookbook" but Hughes is way off >here. There is some additional overhead with OO code but there is *very* >little difference in speed (less than 5% in synthetic benchmarks, and >much less in more complex php code) - certainly not the "signigicant slow >down" that he claims. -- Zeev Suraski <[EMAIL PROTECTED]> CTO & co-founder, Zend Technologies Ltd. http://www.zend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP's OO is bad?
On Sunday 13 May 2001 06:25, Sean Cazzell wrote: > certainly not the "signigicant slow > down" that he claims. I don't know whether or not what Sterling said is true, but I think that your comment that the difference in speed with a larger program would be less is incorrect in view of your benchmark. Your test does so little that I would imagine that the bulk of the execution time is taken up just by the initialisation and closedown of the request (by browser, apache and php) and the time taken in transit. It *could* be that the OO stuff executed many times more slowly than the non-OO. Cheers -- Phil Driscoll -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP's OO is bad?
His series of articles ("top php programming mistakes") is great, and I've heard good things about his "PHP Cookbook" but Hughes is way off here. There is some additional overhead with OO code but there is *very* little difference in speed (less than 5% in synthetic benchmarks, and much less in more complex php code) - certainly not the "signigicant slow down" that he claims. IIRC, later in the article series, Hughes admits he isn't an OO fan, so he's probably a bit biased. Maybe he knows of some case where OO PHP code runs really slow, but since he doesn't present any data to back up his claims I suspect he just guessed that OO PHP would be slow (ie - he made it up!). I don't use OO for everything I do, but if the project is going to be over 1000 lines or so, I find OO code easier to maintain. YMMV. For testing, I used two simple test files that both printed "hello world" five times. I did the benchmarking with ab (apache bench). The OO one: test(); $bo->test(); $bo->test(); $bo->test(); $bo->test(); ?> The non-OO version is the same, but without the class stuff. The non-OO version averaged 580 req/s, while the OO version averaged 550 req/s. This was on a 600mhz pIII with 256megs of ram running Apache 1.3.19 and PHP 4.0.5 on a Linux 2.4.3 kernel. Regards, Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP's OO is bad?
On Sat, 12 May 2001, Mitch Vincent wrote: We too have been developing using an OO approach for awhile - definitely in PHP4. One of the other guys here was more OO than I was in PHP3, but we've standardized more on our coding style in PHP4. I would not doubt that there's some overhead with an OO approach. Enough to make a significant slow down? We run a moderately high volume site - the code base is pretty OO when it's called for, and we've not noticed any significant speed issue. Something going from 20ms to 40ms or 50ms might be a 100% or greater speed decrease, but it's still pretty darn small. If the OO approach lets you code significantly faster than you would otherwise be able to, continue to do so. If speed is an ultimate factor, and you don't use OO in PHP, don't start. (Code in assembly or C if speed is a necessity.) The real-world small penalty you may pay in OO execution time might more than be overcome by getting a project done days or weeks quicker than you would otherwise have been able to. > > I've been coding in PHP for years now and have almost always written > software in the same general way..My code is *totally* object oriented. I > have individual classes for individual modules(parts of the application) -- > everything is in a class.. I've never really noticed a problem with PHP's > execution speed but then I write applications in PHP, not just dynamic web > sites so the things I write rarely get a whole lot of traffic (most apps are > intranet apps and are not available to everyone on the net).. > > So... Is this a bad way of doing things in PHP? Exactly what is > "significant" slow down that Mr. Hughes talks about and does anyone have any > real-world examples that might back up what he says? I am in the process of > writing some benchmarks but would still be interested in any and all other > data from other sources... > > Thanks!! > > -Mitch -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP's OO is bad?
"Overusing OO features: PHP is not an object oriented language, while it does provide object oriented features, you should always be conscious of the fact that using PHP's object oriented features will significantly slow down your code." - a quote taken from Sterling Hughes' "top 21 PHP programming mistakes" listed on the Zend homepage. How true is this? I've been coding in PHP for years now and have almost always written software in the same general way..My code is *totally* object oriented. I have individual classes for individual modules(parts of the application) -- everything is in a class.. I've never really noticed a problem with PHP's execution speed but then I write applications in PHP, not just dynamic web sites so the things I write rarely get a whole lot of traffic (most apps are intranet apps and are not available to everyone on the net).. So... Is this a bad way of doing things in PHP? Exactly what is "significant" slow down that Mr. Hughes talks about and does anyone have any real-world examples that might back up what he says? I am in the process of writing some benchmarks but would still be interested in any and all other data from other sources... Thanks!! -Mitch -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]