Beefy Boxes and Bandwidth Generously Provided by pair Networks
Joe Pathologically Eclectic Rubbish Lister  Comment on   Well,
you've all made some good points. :) Particularly that IO is the
constraint.  A few thoughts...  Sometimes there is a better
algorithm (as opposed to a better optimization). And that
probably requires a better understanding of the core problem.
For example, did the OP really need an exact tally, or would it
have been adequate to sample and extrapolate? If so, what size
sample would have been sufficient, and would it have been ok to
take the first 1..s ints, or would it have been necessary to
take s ints from random positions in the data set. We can't
really answer that because we don't know enough about the data
set.  Another consideration could be maintaining a count as the
data is generated. If over 3GB of integers was generated over
the course of hours, days, weeks, or months, the extra cost of
maintaining a running tally might go un-noticed, whereas a
60-second sudden lag may be a