in reply to efficient perl code to count, rank

The lack of an SSCCE is unfortunate. Without one, we are forced to guess, and I have little confidence in my guesses, based on past experience:

From these experiences, I learnt the importance of don't assume measure and especially find a better algorithm.