[Tickets #6198] Re: One loop less

bugs at horde.org bugs at horde.org
Mon Feb 4 18:13:31 UTC 2008


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://dev.horde.org/horde/whups/ticket/?id=6198
-----------------------------------------------------------------------
 Ticket             | 6198
 Updated By         | Michael Rubinsky <mrubinsk at horde.org>
 Summary            | One loop less
 Queue              | Ansel
 Type               | Enhancement
 State              | New
 Priority           | 1. Low
 Milestone          | 
 Patch              | 
 Owners             | 
-----------------------------------------------------------------------


Michael Rubinsky <mrubinsk at horde.org> (2008-02-04 13:13) wrote:

> - Don't use SELECT *

What's the rationale for this? In this case we actually do want all the
columns. Is there a performance issue with '*' vs putting all the column
names in the query explicitly?

> - Combine the fetchAll db driver with the loop that creates galleries
objects

I don't see how this is reducing the number of loops, your just replacing
a for loop for a while loop from what I can tell. Also, with your change
we're no longer catching any errors that the ->fetchAll() (->fetchRow() in
your version) call can return.

> - As all fields are prefixed with "gallery_id" don't str_replace but 
> use substr(), is faster

Agreed, thanks.

> - countGalleries caches results but never returns it if recalled, as 
> this was not noticed till now I guess that is never recalled so 
> remove the parameters serialization

Yea, I thought I already took that out after I realised that we very
rarely need to obtain the count for the same gallery more than once per
page load. Thanks for catching that.




More information about the bugs mailing list