1. A method for compression comprising performing, by a computer system: receiving a plurality of counts P(i), i=1 to N, each count P(i) corresponding to a symbol S(i) of a plurality of symbols in a data set, the plurality of counts P(i) being unsorted; assigning bit lengths to each symbol S(i), i=1 to N, of N according to the counts P(i) without first sorting the counts P(i) to obtain a first canonical Huffman code; and canonical Huffman coding the data set using the first canonical Huffman code.