#1510: Time is wasted in Hydration
------------------------------+---------------------------------------------
  Reporter:  colnector        |       Owner:  romanb               
      Type:  defect           |      Status:  assigned             
  Priority:  critical         |   Milestone:  1.0.3                
 Component:  Query/Hydration  |     Version:  1.0.2                
Resolution:                   |    Keywords:                       
  Has_test:  0                |    Mystatus:  Pending Core Response
 Has_patch:  0                |  
------------------------------+---------------------------------------------
Comment (by colnector):

 I truly apologize if what I wrote seemed like an insult. The word
 'imagine' was wrongly chosen and I guess it should have been more around
 'consider it to be'. My intentions were good.

 What I'm trying to say it that since the hydration algo is so critical in
 Doctrine, every bit of it has to be meticulously scrutinized. By every bit
 I mean even things like (and as I'm not proficient with the code itself
 these are general):

 * when to calculate expressions and when to save their results so they're
 not calculated in the loop
 * when to do a function call and when not to
 * which function calls to use (static/dynamic)
 * whether or not to pass more variables to a function and whether to pass
 by reference
 * using PHP string with single comma ' instead of double "

 I've currently looked at the result set parsing loop and it seems to me
 that many things should have been calculated outside the loop and are
 calculated inside (thus for every row).

 Line 131:
 {{{
 $listeners[$componentName]->preHydrate($event);
 }}}
 What if there are no listeners? Are we doing an extra function call?

 Line 176:
 {{{
 // It would be nice if this could be moved to the query parser but I could
 not find a good place to implement it
 if ( ! isset($map['parent'])) {
 }}}
 This is in the loop...

 Line 196:
 {{{
 if ( ! $relation->isOneToOne() && $driver->initRelated($prev[$parent],
 $relationAlias)) {
 }}}
 Can't the relation type be determined outside this inner loop?

 Also, perhaps consider not using _gatherRowData() and _setLastElement() as
 functions but place their code in the loop. It's a shame PHP doesn't have
 inline functions but perhaps sacrifying a bit of readability would help
 performance.

 These are all very minor things when programming in general, but should be
 considered in the hydration loop specifically.

 Thanks

-- 
Ticket URL: <http://trac.doctrine-project.org/ticket/1510#comment:10>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"doctrine-svn" group.
 To post to this group, send email to [email protected]
 To unsubscribe from this group, send email to [EMAIL PROTECTED]
 For more options, visit this group at 
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---

Reply via email to