Discussion Board
Go to the previous messageGo to the following message
Current Forum: Homework 4 - Huffman Trees (Part 1)
Date: Wed Oct 10 2001 11:04 am
Author: Bortz, Andrew S. <abortz@andrew.cmu.edu>
Subject: Re: general clarification on FileBitReader/Writer classes

I can't imagine that a 12% speed difference matters that much to you. We're in Java, so we've already decided that speed is not important, at least not percentage differences. Time complexity of algorithms, yes, but a factor of 12% is not important. I'm surprised, however, that readBits() runs as fast as it does - I'd think readByte() would be many times faster.

Anyway, think, for a minute, about if you actually wanted to get signed bytes from a file. So if readByte() returned something unsigned, you'd have to correct it. It's just two sides of the same coin: which interface do you want? Obviously, you'd rather it return an unsigned value. I however, think readBits() is more than enough, especially given that you could optimize for this case (read 8 aligned bits in) if you really wanted. Also, since Byte/byte in Java is a signed value, you'd think that readByte() would return a byte with a signed value. It's all a matter of personal opinion, however.
Post response

Go to the previous messageGo to the following message
Current Thread Detail:
general clarification on FileBitReader...      Liu, William Y.      Mon Oct 8 2001 10:34 pm       
Re: general clarification on FileBi...      Lee, Charles C.      Mon Oct 8 2001 11:13 pm       
Re: general clarification on Fil...      Cipriani, Jason A.      Mon Oct 8 2001 11:30 pm       
Re: general clarification on ...      Bortz, Andrew S.      Tue Oct 9 2001 12:28 am       
Re: general clarification ...      Cipriani, Jason A.      Wed Oct 10 2001 1:01 am       
Re: general clarificati...      Bortz, Andrew S.      Wed Oct 10 2001 11:04 am       
Re: general clarific...      Cipriani, Jason A.      Wed Oct 10 2001 12:45 pm       
Re: general clarific...      Cipriani, Jason A.      Wed Oct 10 2001 12:50 pm       
Re: general clari...      Cipriani, Jason A.      Wed Oct 10 2001 12:51 pm       

Back to previous screen