100x speedup for TGA loading

It seems that tga loading of textures with alpha channel has not got enough optimalization love. Loading RGB texture was taking few ms, loading RGBA texture of same size was taking 1-2 seconds.

By adding buffering to TGALoader, it is now possible to load same data in umpteen ms - which changes startup of my application from 10-15 seconds to 2-3 seconds.

Inside Image load(InputStream in, boolean flip), replace


DataInputStream dis = new DataInputStream(in);




DataInputStream dis = new DataInputStream(new BufferedInputStream(in));


and observe 100x improvement in loading speed for bigger tga textures.

1 Like

wow about 100x speedup!!

good job!

Thanks, added to svn.