Marc, I'd question the benefit of making the images jpeg.  How fast is
jpeg decoding?  I know jpeg encoding is relatively slow.  This is all
going to be machine dependent (relative speed of CPU vs Disk system).
With a fast disk system and a slow CPU it could be faster to read a much
larger file that doesn't require any decompression.  Does anyone have
any real world benchmarking comparisions?

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).

- John Wright
Starfire Research

Marc Palmer wrote:
>
> > Updated:
> > SeekingRocket crashes should be a thing of the past.
> > a few misc bugs fixed.
> > *3* opponents now!
>
> > http://www.geocities.com/Psionic1981
>
> > A few questions to anyone...
> > (1) It's sloooow loading. is it just the filesizes? i'm currently
> streaming
> > the loading process with different threads... is there anything more i
> can
> > do?
>
> Run the VM with profiling switched on and stop it before you play the
> game � it should show the bottlenecks.
>
> I personally think that loading the 3+MB targa files could be an issue
> ;-)
> You should make them jpegs for a start!
>
> Your TGA loading code looks -very- suspect.
>
> You are doing this:
>
>   bufferedReader = new BufferedInputStream( new DataInputStream( new
> FileInputStream( fileName));
>
> A. This looks totally unnecessary to me, and is doubling all your calls
> to read(). Forget the DataInputStream, as you never use it.
>
> B. You are reading the file byte by byte. This is VERY VERY slow. Every
> time you call read() it's got to call read() on DataInputStream, and then
> on FileStream, with all the Java security checks happening! For a 3MB
> file thats a hell of a lot!
>
> It will be -much- faster if you:
>
> A. Convert the files to high quality jpeg
>
> -or-
>
> B. Load the whole file into a byte array in one call, then convert the
> bytes to the output format in the image buffer. i.e.
>
>    File f = new File( fileName);
>    byte[] tempBuffer = new byte[(int)f.length()];
>    FileInputStream fis = new FileInputStream( f);
>    try
>    {
>      fis.read( tempBuffer);
>    }
>    finally
>    {
>      fis.close();
>    }
>
>    // Now go through the byte[] and convert the data.
>
> I am sure you will find this -dramatically- improves load time. Judging
> by these "mistakes" your mesh loading code can probably be optimized
> significantly, but I'm not sure how much of the time is spent on that.
>
> > (2) Anyone know how i can get a profile of video memory being used by the
> > java3d process? Some way of really knowing how much i'm using in
> textures,
> > etc.
>
> I'll pass on that.
>
> Cheers
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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".

===========================================================================
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