Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.11.5

Request #18602 Small Optimization for DB_DataObject::fetch()
Submitted: 2011-06-17 21:52 UTC
From: shadesofgraylin Assigned: alan_k
Status: Closed Package: DB_DataObject (version svn)
PHP Version: 5.2.17 OS: WindowsXP
Roadmaps: (Not assigned)    
Subscription  


 [2011-06-17 21:52 UTC] shadesofgraylin (Graylin Kim)
Description: ------------ The current fetch implementation calls str_replace twice when once would be sufficient[1]. Current Implementation[2]: $kk = str_replace(".", "_", $k); $kk = str_replace(" ", "_", $kk); Suggested Implementation: $kk = str_replace(array("."," "), "_", $k); With this small fix I experienced gains of 15-20% on fetches. [1]http://us3.php.net/manual/en/function.str-replace.php [2]http://svn.php.net/viewvc/pear/packages/DB_DataObject/trunk/DataObject.php?view=markup

Comments

 [2011-06-17 22:15 UTC] shadesofgraylin (Graylin Kim)
 [2011-06-17 22:19 UTC] shadesofgraylin (Graylin Kim)
-Package Version: 1.9.5 +Package Version: svn -PHP Version: 5.2.12 +PHP Version: 5.2.17
Updated the PHP Version and Package Version. Who should be contacted to have the newer releases of PHP 5.2.x added to the pull down menu? It stops at 5.2.12 currently.
 [2011-06-22 15:13 UTC] alan_k (Alan Knowles)
-Status: Open +Status: Closed -Assigned To: +Assigned To: alan_k
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Thanks - well spotted. Fixed in fetchRow as well, and reduce opcodes might help.... http://svn.php.net/viewvc/pear/packages/DB_DataObject/trunk/DataObject.php? r1=312373&r2=312374&view=patch