[plt-scheme] Memory Use of Internal Representations

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Apr 9 21:07:34 EDT 2009

At Thu, 09 Apr 2009 15:12:34 +0100, Erich Rast wrote:
> Suppose I have a huge hash-table in memory that maps strings to 64 bit
> values. Now I'm wondering what is the most memory-savvy way to store
> such a number in the hash-table.
> 
> Should I use: (1) an _uint64 from the FFI, (2) an exact number, (3) two
> fixnums in a structure or vector, (4) a bytes string, or <insert
> something else>? 

(1) and (2) are the same, and that's what I recommend.

I think a vector of fixnums (three on a 32-bit platform or two on a
64-bit platform) could be slightly more compact, but it's not a big
difference --- especially, I imagine, compared to the overhead of the
string keys.



Posted on the users mailing list.