[antlr-interest] (not really about) philosophy about translation

Steve Lianoglou lists.steve at arachnedesign.net
Thu Nov 2 12:14:13 PST 2006


Hi guys,

I've been casually following this thread and don't have much to say,  
but I would like to point out:

> That's a great example. You make the assumption that an array of  
> booleans is somehow going to be slower or use more memory
> than a bitvector. You've got to let that old thinking go, Luke! You  
> worry about your application and pick the appropriate
> data structure for it. Let the compiler and runtime be smart about  
> performance and memory management. It is better at
> those things than you are (and certainly better than you think it is).

At some point an array of booleans (boolean[]) in Java actually used  
one byte to store each bit, so appearances aren't always what they  
seem? That's an 8x bigger data structure than you would have been  
bargaining for ... and sometimes it really does make a difference.

And by "at some point" .. this was seemingly the case in Java 1.2.2.

I'm only mentioning this because:

(1) I'd be very happy to hear that this isn't true anymore; and I  
figured since there's sure to be many-a-Java guru here, someone may  
actually really know the answer to that one (or point me to where I  
could investigate that further). I had to deal with this over the  
summer because I was getting into the bowels of a library I was  
using, and to my surprise found it noted as such in the docs:

http://dsd.lbl.gov/~hoschek/colt/api/cern/colt/bitvector/BitVector.html
(Look for "Why this class?")

I also was searching the web to look into see if that still was the  
case. I found something similarly mentioned elsewhere, but I think it  
was also somewhat dated; moreover, I can't find it again!

(2) Maybe swerve the conversation to more tangible topics :-)

I should probably ask in comp.lang.java or some such, but how many  
times does this thing come up in a passing conversation? I just  
couldn't resist.

Thanks,
-steve


More information about the antlr-interest mailing list