> By using a buffered stream he is not reading the file byte by byte, but
> rather buffer by buffer (tweak the size of the buffer for better
> performance - i.e. if your default buffer is 1024 bytes and your
> smallest file is 50K crank that buffer up to 25K or so).

Well I couldn't be bothered to do the JPEG test (very boring writing code 
with mediatracker to wait for the image to be ready) but a quick test of 
the game's TargaReader vs. My own FastTargaReader yielded identical 
results.

Why? Partly because Java has no unsigned byte type, so you have to call a 
method (or inline some code) to check for bytes < 0 and add 256 to 
correct the sign! If it is possible to write the code without this (or as 
little of it as possible) you can get an increase of about 5% I found, 
but it's nothing substantial.

Basically the performance is almost identical whatever you do. 

The BufferedReader/single read(bigbuf) gives the biggest gain � without 
it and just a plain FileStream, you're looking at 8 seconds even when the 
file is cached by the O/S.

Using the buffered reader / single read() call, best time is ~220ms, 
Worst is ~700ms when file is not cached by O/S. For a 3.5MB file this is 
no big deal. Machine: 1.7ghz Pentium 4, Win XP, JDK 1.4

Java is getting damn fast, and it looks like the stories of slow method 
calls are just that. Thanks for making me check this out John!

Now I've eaten my hat, how about you try the JPEG test?

Kind regards,
Marc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ W<A> ~~~~~
(o) Wangjammer5 (Marc Palmer) 
( ) Wangjammer7 

www.wangjammers.org = Java Consultants (Web|Smartcards|Crypto)

==========================================================================To 
unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to