"mircea.markus" wrote : an boolean is hold on a bit. An RegularEnumSet
aggregates an long (64 bit) + some caching arrays (other bits as well). From a memory POV
it is optimal to aggregate booleans directly (than EnumSets wrapping enums).
|
A boolean is sizeof(unsigned char) which is a byte on every platform I know of. An array
reference is the size of a pointer, so typically 32 or 64bit. There are 2. So when
accounting for the reference to the EnumSet itself, on a 32 bit architecture you need more
than 20 booleans to exceed the space utilization of an enumset with 64 or less Enums.
java.util.BitSet uses slightly less space than EnumSet (1 array ref + 1 32 bit value).
That said, any efficiency gain here is neligable, so we should be focusing on what best
fits the design.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081002#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...