Limbic~Region has asked for the wisdom of the Perl Monks concerning the following question:
next if (exists $cache{$_}); or next if (grep /\b$_\b/ , @cache); and later on ..... push @cache , $_; or $cache{$_}++;
What are the dynamics of each approach? Internally does
and then re-creation have any impact as far as memory allocation/speed? Is there a point at which having more files in the cache give one approach a speed increase over the other? Is there a rule of thumb like if under 100 items, use A?%cache = (); or @cache = ();
Basically, I am asking how does each process work internally so that I can decide which method to implement based off my dynamic environment. I can't really benchmark without live data. I can siphon off live data for file variation, but I can't replay it at the same speed as it happens in production so I never know how deep the directory will be.
Cheers - L~R
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Internals question - "exists" for hash keys versus grep'ing array
by dragonchild (Archbishop) on Mar 19, 2003 at 19:04 UTC | |
by Limbic~Region (Chancellor) on Mar 19, 2003 at 19:28 UTC | |
|
Re: Internals question - "exists" for hash keys versus grep'ing array
by diotalevi (Canon) on Mar 19, 2003 at 19:32 UTC |