#38528 [Opn->Bgs]: ArrayObject iteration slow

From: Date: Mon, 21 Aug 2006 07:03:50 +0000
Subject: #38528 [Opn->Bgs]: ArrayObject iteration slow
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-101025@lists.php.net to get a copy of this message
ID: 38528 Updated by: helly@php.net Reported By: joel at cybersewer dot com -Status: Open +Status: Bogus Bug Type: SPL related -Operating System: Windows XP SP2 +Operating System: * -PHP Version: 5.2.0RC2 +PHP Version: 5.* New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php now way to do it different Previous Comments: ------------------------------------------------------------------------ [2006-08-21 00:35:25] joel at cybersewer dot com Description: ------------ Iteration through a large ArrayObject (e.g. 10,000+ items) is very slow. Reproduce code: --------------- $a = new ArrayObject; for ($i = 0; $i < 10000; $i++) $a[] = $i; // This is slow foreach ($a as $k => $v); // This is much faster, even though I thought this was basically what ArrayObject's getIterator method did. $it = new ArrayIterator($a->getArrayCopy()); foreach ($it as $k => $v); ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38528&edit=1

« previous php.bugs (#101025) next »