[PEAR-BUG] Req #18602 [Opn->Csd]: Small Optimization for DB_DataObject::fetch()

[email protected]
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at http://pear.php.net/bugs/bug.php?id=18602&edit=1

 ID:               18602
 Updated by:       [email protected]
 Reported By:      graylin dot kim at gmail dot com
 Summary:          Small Optimization for DB_DataObject::fetch()
-Status:           Open
+Status:           Closed
 Type:             Feature/Change Request
 Package:          DB_DataObject
 Operating System: WindowsXP
 Package Version:  svn
 PHP Version:      5.2.17
-Assigned To:      
+Assigned To:      alan_k
 Roadmap Versions: 
 New Comment:

-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


Previous Comments:
------------------------------------------------------------------------

[2011-06-17 18:19:00] shadesofgraylin

-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-17 18:15:21] shadesofgraylin

Added #patch
bug:18602;patch:fetch-optimization-str_replace;revision:1308330921;.

------------------------------------------------------------------------

[2011-06-17 17:52:01] shadesofgraylin

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

------------------------------------------------------------------------


-- 
Edit this bug report at http://pear.php.net/bugs/bug.php?id=18602&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.