in reply to Super fast file creation needed
How about this construct: instead of testing for and creating files, put an entry in a hash and test for that (I'm reusing your $filename variable here, except I'm not using it as a filename):
Theoretically, that would run out of memory some time, but I can't imagine a situation where your file-based strategy would be any better. If you've got a Gb of RAM you should be able to store a couple of million "filenames" at leastmy %seen; # declare this outside the loop # do the following for each $filename if ($seen{$filename}++) { # $filename is a duplicate } else { # never seen this before }
updated: removed exists, added some comments
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Super fast file creation needed
by ikegami (Patriarch) on Oct 18, 2007 at 23:40 UTC | |
|
Re^2: Super fast file creation needed
by Plankton (Vicar) on Oct 18, 2007 at 23:30 UTC | |
by chromatic (Archbishop) on Oct 19, 2007 at 05:37 UTC |