1. A computer-implemented method for compressing a set of small strings, the method comprising: calculating, by a processor, n-gram frequencies for a plurality of n-grams over the set of small strings; selecting, by the processor, a subset of n-grams from the plurality of n-grams based on the calculated n-gram frequencies; defining, by the processor, a mapping table that maps each n-gram of the subset of n-grams to a unique code, wherein the unique codes are variable-length one or two byte codes; and compressing, by the processor, the set of small strings by replacing n-grams within each small string in the set of small strings with corresponding unique codes from the mapping table.
1. A computer-implemented method for compressing a set of small strings, the method comprising: calculating, by a processor, n-gram frequencies for a plurality of n-grams over the set of small strings; selecting, by the processor, a subset of n-grams from the plurality of n-grams based on the calculated n-gram frequencies; defining, by the processor, a mapping table that maps each n-gram of the subset of n-grams to a unique code, wherein the unique codes are variable-length one or two byte codes; and compressing, by the processor, the set of small strings by replacing n-grams within each small string in the set of small strings with corresponding unique codes from the mapping table. 2. The method according to claim 1 , the selecting further comprising: calculating, by the processor, a space saving amount for each n-gram of the plurality of n-grams as a product of (1) the n-gram frequency and (2) a difference between a character length of the n-gram and a length of the unique codes; and selecting a number of the n-grams with the highest calculated space saving amount as the subset of n-grams.