[plt-scheme] Memory Use of Internal Representations

From: Erich Rast (erich at snafu.de)
Date: Thu Apr 9 10:12:34 EDT 2009

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>? 

Another, somehow related question: 

(eq? (string->symbol "a") (string->symbol "a"))
==> #t

Can I conclude from this that the two interned symbols occupy the same
memory (plus constant overhead like a pointer) in Mzscheme? If yes, is
there a similar memory-savvy encoding for strings?

Best regards,


Posted on the users mailing list.