in reply to each or keys?
But when you leave the loop very early with each, well that is a lot faster than going through all of them! (Hint, you are breaking out after an entry or two.)
UPDATE
My wording confused people. A foreach loop has to build a complete list of values before it does any processing. (Except for a hack for the range operator.) A while loop processes entries as it walks through the list. So the keys approach has to build the whole list even though most will be ignored, the each approach does not. But when you go through all of them, the each approach is doing basically what foreach did up front.
That make sense?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: each or keys?
by extremely (Priest) on Oct 11, 2000 at 02:51 UTC | |
by tilly (Archbishop) on Oct 11, 2000 at 03:02 UTC | |
by extremely (Priest) on Oct 11, 2000 at 03:52 UTC | |
|
RE: Re: each or keys?
by rdw (Curate) on Oct 11, 2000 at 11:05 UTC |