Doc #54870 [NEW]: References Comment Should be Removed

From: Date: Fri, 20 May 2011 05:42:52 +0000
Subject: Doc #54870 [NEW]: References Comment Should be Removed
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-6604@lists.php.net to get a copy of this message
From: Operating system: PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:References Comment Should be Removed Description: ------------ I've done some testing of variable reference behavior in PHP and was able to disprove something in the documentation. On the manual page at http://php.net/manual/en/functions.arguments.php there is a comment that says, "Note that passing by reference doesn't speed up your php script. PHP is smart enough not to simply copy data every time the language requires it. Rahter, PHP uses a reference and waits until the copy (a copied variable or a copy used in a function) is actually used as a copy and creates one then." That statement is not correct in any circumstance I could come up with, except for a read-only function accepting a one megabyte string argument. I observed massive performance improvements when using references to prevent the copy-on- write behavior. So, to say that passing by reference doesn't speed up your php script is not correct. It is only correct to say that if a parameter is passed by value and never modified, then PHP wont make an extra copy of it. Test script: --------------- Details posted at http://www.miqrogroove.com/writing/php-references-for-speed/ -- Edit bug report at http://bugs.php.net/bug.php?id=54870&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54870&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54870&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54870&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54870&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54870&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54870&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54870&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54870&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54870&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54870&r=support Expected behavior: http://bugs.php.net/fix.php?id=54870&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54870&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54870&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54870&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54870&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54870&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54870&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54870&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54870&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54870&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54870&r=mysqlcfg

« previous php.doc.bugs (#6604) next »