I am working to develop a bioinformatic application that will require the development of a huge hash table with billions of keys.
As a simple example, one key might have the following string sequence: "TGGAC" - which has a ByteCount of 32.
Is it possible in Mathematica to store each letter of the 5-letter string as a 2-bit binary number to reduce the memory requirement for each key?
For example: A might be encoded as 00 T might be encoded as 01 G might be encoded as 10 C might be encoded as 11
FromDigits[Characters["TGGAC"] /. Thread[{"A", "T", "G", "C"} -> Range[0, 3]], 4] // ByteCount
->(* 16 *)
. As you can see, short objects are dominated by per-object overheads. There's a possibility to work around this by packing more of them on a single object. $\endgroup$