By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,278 Members | 1,359 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,278 IT Pros & Developers. It's quick & easy.

performance hit with OOP?

P: n/a
I found myself writing the following comment in the overall
constructor comment for the class McLoops. And when I got done writing
this comment, I began to wonder, damn, at what point does the
performance hit become too expensive to scale? Does anyone have any
stats on this? How many calls to a database can you have on one page
before that page becomes painfully slow? How many hits does it take to
slow a plain html file versus a simply included() PHP file versus a
system like Smarty? How many lines of code does Phorum execute to
render a forum with 200 entries in it?

Does anyone know where such statistics can be found?

* It's worth noting where McLoops fits into the picture. Please
consider the complete history
* of a single function: showLinkArea(). These are the events:
*
* 01. showLinkArea() is encountered in a template and executed
* 02. showLinkArea() sends McControllerForAll the string
"showLinkArea"
* 03. McControllerForAll sends "showLinkArea" to McRunCommand
* 04. McRunCommand calls up CommandShowLinkArea and calls test()
* 05. If test() returns true then McRunCommand calls the
command() method of CommandShowLinkArea
* 06. CommandShowLinkArea calls for an arrangement called
"showLinkArea"
* 07. showLinkArea.php, the arragement, in default form calls
elementsPublicListAllForLinkArea()
* 08. elementsPublicListAllForLinkArea(), calls up McLoops and
runs through it.
* 09. elementsPublicListAllForLinkArea(), sets "SeekArrangement"
as the action object for McLoop
* 10. McLoops loads ActionsSeekArrangement and calls its 4 action
methods
* 11. ActionsSeekArrangement loads many arrangments to output the
various aspects of the link area
* 12. ActionsSeekArrangement, by calling other arrangements,
probably causes dozens of element() functions to be called.
* 13. Those element() functions in turn call many other objects.

Mind you, this is one function. There might be 20 functions in a
template. Or more.
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
lawrence wrote:
I found myself writing the following comment in the overall
constructor comment for the class McLoops. And when I got done writing
this comment, I began to wonder, damn, at what point does the
performance hit become too expensive to scale? Does anyone have any
stats on this? How many calls to a database can you have on one page
before that page becomes painfully slow? How many hits does it take to
slow a plain html file versus a simply included() PHP file versus a
system like Smarty? How many lines of code does Phorum execute to
render a forum with 200 entries in it?

Does anyone know where such statistics can be found?

* It's worth noting where McLoops fits into the picture. Please
consider the complete history
* of a single function: showLinkArea(). These are the events:
*
* 01. showLinkArea() is encountered in a template and executed
* 02. showLinkArea() sends McControllerForAll the string
"showLinkArea"
* 03. McControllerForAll sends "showLinkArea" to McRunCommand
* 04. McRunCommand calls up CommandShowLinkArea and calls test()
* 05. If test() returns true then McRunCommand calls the
command() method of CommandShowLinkArea
* 06. CommandShowLinkArea calls for an arrangement called
"showLinkArea"
* 07. showLinkArea.php, the arragement, in default form calls
elementsPublicListAllForLinkArea()
* 08. elementsPublicListAllForLinkArea(), calls up McLoops and
runs through it.
* 09. elementsPublicListAllForLinkArea(), sets "SeekArrangement"
as the action object for McLoop
* 10. McLoops loads ActionsSeekArrangement and calls its 4 action
methods
* 11. ActionsSeekArrangement loads many arrangments to output the
various aspects of the link area
* 12. ActionsSeekArrangement, by calling other arrangements,
probably causes dozens of element() functions to be called.
* 13. Those element() functions in turn call many other objects.

Mind you, this is one function. There might be 20 functions in a
template. Or more.


OOP performance in PHP4 varies across the board. Depending on how you
architect your application, your mileage may vary. Having a
multi-processor server with oodles of RAM helps a lot. Generally
speaking, the rule of thumb for PHP4 is that an app that leans towards
the OO paradigm will be slower when compared to an app designed to be
procedural in nature.

Amir.

--
Rules are written for those who lack the ability to truly reason, But for
those who can, the rules become nothing more than guidelines, And live
their lives governed not by rules but by reason.
- James McGuigan
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.