note 128694 added to class.iterator

From: Date: Thu, 06 Jul 2023 14:30:18 +0000
Subject: note 128694 added to class.iterator
Groups: php.notes 
Request: Send a blank email to php-notes+get-220655@lists.php.net to get a copy of this message
Perfomance: if we take code from example , comment all dump() all method, put only one ellement in "$array" property , create one object (like an example) <?php $it = new myIterator; ?> And try execute foreach of object myIterator (what implements Iterator) without any functional inside foreach like and try to do this 1 000 000 time like a code <?php for($i=0;$i<2200000;$i++) foreach($it as $key => $value) {} ?> - this time take like 1 second (2 200 000 calls Iterator per second). It mean what try to call Iterator's "magick" methods for cycles of some propertys of object not so fast. For example foreach simple array (or property of class with array typehint) directly with one ellement will be like 30 000 000 Well implements Iterator it is for gracefull but not for hight perfomance ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.159.168 (proxied: 83.220.237.14) ---- Manual Page -- https://php.net/manual/en/class.iterator.php Edit -- https://main.php.net/note/edit/128694 Del: integrated -- https://main.php.net/note/delete/128694/integrated Del: useless -- https://main.php.net/note/delete/128694/useless Del: bad code -- https://main.php.net/note/delete/128694/bad+code Del: spam -- https://main.php.net/note/delete/128694/spam Del: non-english -- https://main.php.net/note/delete/128694/non-english Del: in docs -- https://main.php.net/note/delete/128694/in+docs Del: other reasons-- https://main.php.net/note/delete/128694 Reject -- https://main.php.net/note/reject/128694 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220655) next »