Arrays also have some overhead though so if your objects are all of
equal size you could use just one array (of ints?) for all of them and
create functions for indexing correctly in your array. A bit brittle
but very space efficient.
Of course this throws all of the benefits of Clojure or even
I'm writing a program that will have millions of small structures in
it. If I were writing in C (or Java I guess), I estimate the object
size to be about 40 bytes. In Clojure, using a struct map I've made a
rough measure I think that the objects are weighing in at about
200bytes.
1) I know
Java doesn't have a C-like structure type, so Java objects still have
overhead. If you want the absolute minimum number of bytes in memory,
you can create Java primitive arrays in Clojure:
(make-array Integer/TYPE 100)
Then access them with the aset... and aget functions.
-Stuart Sierra
On