Req #72492 [NEW]: optimize copy on write when no actual write is performed
| From: | youwish dot spambot at nospam dot pls dot example dot org | Date: | Sat, 25 Jun 2016 09:00:04 +0000 |
| Subject: | Req #72492 [NEW]: optimize copy on write when no actual write is performed | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-201841@lists.php.net to get a copy of this message | ||
From: youwish dot spambot at nospam dot pls dot example dot org
Operating system: Irrelevant
PHP version: 7.1.0alpha1
Package: Performance problem
Bug Type: Feature/Change Request
Bug description:optimize copy on write when no actual write is performed
Description:
------------
Not very important, I'm dropping this findings here so they don't get
lost in the meanders of web.
These operations (and similar ones) don't require a copy to be performed
as the result is identical to the original.
Test script:
---------------
$foo = str_repeat('foo', 100000);
var_dump(memory_get_usage());
$baz = '' . $foo; // $baz is identical to $foo
var_dump(memory_get_usage());
unset($foo, $baz); echo "\n";
$foo = array_fill(0, 1000, 'foo');
var_dump(memory_get_usage());
$baz = array_merge($foo, []); // $baz is identical to $foo
var_dump(memory_get_usage());
unset($foo, $baz); echo "\n";
$foo = array_fill(0, 1000, 'foo');
var_dump(memory_get_usage());
$baz = array_slice($foo, 0); // $baz is identical to $foo
var_dump(memory_get_usage());
// etc...
--
Edit bug report at https://bugs.php.net/bug.php?id=72492&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72492&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72492&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72492&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72492&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72492&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72492&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72492&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72492&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72492&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72492&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72492&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72492&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72492&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72492&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72492&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72492&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72492&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72492&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72492&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72492&r=mysqlcfg