in reply to Perl hit counter for multiple ranges, optimization or options in other languages?

Your description suggests that your data are all integers - is this the case? If so there will be a lot of duplicate data points so you can first of all tot up all the same integers into a hash. Only once you have done that should you think about putting them into the bins.

You should then sort the keys of your totals hash and the keys of your bins hash so you only have to step through each hash once.

You could do this in any language, but perl will probably be as good as most. Have a look in your favourite algorithms book as this is not an uncommon sort of task and will be covered there in detail.

  • Comment on Re: Perl hit counter for multiple ranges, optimization or options in other languages?

Replies are listed 'Best First'.
Re^2: Perl hit counter for multiple ranges, optimization or options in other languages?
by SaktiMonk (Initiate) on Aug 07, 2013 at 22:42 UTC
    Sounds good, I'll try this one and see what happens