Optimized the charset file generation algorithms and code ("--make-charset").
On a certain test case, this has improved the time to generate a charset file
from 55.5 to 19.5 seconds while generating the exact same file.
In cmp_ratio(), stabilize the sorting order differently from the way we
happened to be doing it before.  This results in subtly different charset files
being generated for the same input data, but arguably the new stabilization is
more logical, and it helps reduce the number of recalculations and thus speeds
up charset file generation (now 16.5 seconds in the test case mentioned in the
previous commit).
Stabilize the sort order in cmp_count()
Minor optimizations in cmp_ratio()
In count_sort_t, renamed the pos field to index since its meaning is different
from that of the pos variable that we use in the same function.