in reply to Revisiting array context

You're algo isn't going to be limited by the cpu for incrementing integers. Most of the time you are going to be blocking on your harddrive.

Why not use threads instead? You could have one thread reading off the file system and caching the stat info while the other thread is popping off your cache.

If you did this, I'm going to guess, most of the time your incrementing thread is going to be waiting anyway.

If you are running this on a linux system, you will get better performance (not really, but your script will run faster) if you do this:

find .; ./count.pl
Linux will most likely cache most of the info into memory :) Some other os's will do this too ;)