POV-Ray : Newsgroups : povray.unofficial.patches : My personal wishlist : Re: My personal wishlist Server Time
2 Sep 2024 20:19:29 EDT (-0400)
  Re: My personal wishlist  
From: Nieminen Juha
Date: 29 Feb 2000 07:38:29
Message: <38bbbdc4@news.povray.org>
Ron Parker <ron### [at] povrayorg> wrote:
: Perl doesn't have what you'd call "iterators" per se.  To iterate over an
: associative array in Perl, you do:

:   for $index ( keys( %assoc_array ) ) {
:     do_stuff_with( $assoc_array{$index} )
:   }

  I think this is slower than using iterators.
  Referencing to an object with an iterator is a constant-time operation
and incrementing the iterator is an amortized constant-time operation.
Thus, going through the whole array is an O(n)-time operation.
  Indexing one element with a key is an O(log n)-time operation (at least
with the STL map), so going through all elements by indexing each one of
them would be a O(n*log n)-time operation.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.