counting sort and a quick stab at a  perf test