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

Request #18605 Patch DB_DataObject::toArray() to sprintf only as needed
Submitted: 2011-06-18 00:23 UTC
From: shadesofgraylin Assigned: alan_k
Status: Closed Package: DB_DataObject (version SVN)
PHP Version: 5.2.12 OS: Windows XP
Roadmaps: (Not assigned)    
Subscription  


 [2011-06-18 00:23 UTC] shadesofgraylin (Graylin Kim)
Description: ------------ While, it may be normal usage for DB_DataObject::toArray() to be called with a format argument, in the instances where it is not (i.e. no formatting needs to occur) the function runs unnecessarily slow by calling sprintf('%s') where it has no effect. I propose changing the $format default to null and checking for the format prior to any sprintf call to avoid this drag on calls that do not require formatting. Locally, I experienced 15+% speed improvement on toArray with no formatting arguments by patching this change.

Comments

 [2011-06-18 00:24 UTC] shadesofgraylin (Graylin Kim)
 [2011-06-22 15:04 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. Patch is similar. Thanks for spotting this. http://svn.php.net/viewvc/pear/packages/DB_DataObject/trunk/DataObject.php? r1=310231&r2=312373&view=patch