performance hit with OOP?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lawrence

    performance hit with OOP?

    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 McControllerFor All the string
    "showLinkAr ea"
    * 03. McControllerFor All sends "showLinkAr ea" to McRunCommand
    * 04. McRunCommand calls up CommandShowLink Area and calls test()
    * 05. If test() returns true then McRunCommand calls the
    command() method of CommandShowLink Area
    * 06. CommandShowLink Area calls for an arrangement called
    "showLinkAr ea"
    * 07. showLinkArea.ph p, the arragement, in default form calls
    elementsPublicL istAllForLinkAr ea()
    * 08. elementsPublicL istAllForLinkAr ea(), calls up McLoops and
    runs through it.
    * 09. elementsPublicL istAllForLinkAr ea(), sets "SeekArrangemen t"
    as the action object for McLoop
    * 10. McLoops loads ActionsSeekArra ngement and calls its 4 action
    methods
    * 11. ActionsSeekArra ngement loads many arrangments to output the
    various aspects of the link area
    * 12. ActionsSeekArra ngement, 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.
  • Amir Khawaja

    #2
    Re: performance hit with OOP?

    lawrence wrote:
    [color=blue]
    > 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 McControllerFor All the string
    > "showLinkAr ea"
    > * 03. McControllerFor All sends "showLinkAr ea" to McRunCommand
    > * 04. McRunCommand calls up CommandShowLink Area and calls test()
    > * 05. If test() returns true then McRunCommand calls the
    > command() method of CommandShowLink Area
    > * 06. CommandShowLink Area calls for an arrangement called
    > "showLinkAr ea"
    > * 07. showLinkArea.ph p, the arragement, in default form calls
    > elementsPublicL istAllForLinkAr ea()
    > * 08. elementsPublicL istAllForLinkAr ea(), calls up McLoops and
    > runs through it.
    > * 09. elementsPublicL istAllForLinkAr ea(), sets "SeekArrangemen t"
    > as the action object for McLoop
    > * 10. McLoops loads ActionsSeekArra ngement and calls its 4 action
    > methods
    > * 11. ActionsSeekArra ngement loads many arrangments to output the
    > various aspects of the link area
    > * 12. ActionsSeekArra ngement, 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.[/color]

    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

    Comment

    Working...