Re: How can I make the smallest structure possible?

2009-03-10 Thread mac
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

How can I make the smallest structure possible?

2009-03-09 Thread Bradbev
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

Re: How can I make the smallest structure possible?

2009-03-09 Thread Stuart Sierra
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