TextureLoader and Performance

Hi all,

I was wondering why my XML loader was so slow, so I decided to do some System.currentMillis() benchmarks on all aspects of it.

The slowest bit by far was the TextureLoading. So here are my findings:

JPG - 1500

PNG - 1594

TGA - 179

Divide those numbers by 1000 and you would get the seconds it takes to load a 512x512 texture.

JPG and PNG use ImageIO to load them, but TGA uses jME’s own loader.

Its just a headsup to warn you if you haven’t already tested for such a thing and wondering why your app is slow at startup.


Pre-loading images would definantly speed that up. Loading a md2 file by itself takes like 20 seconds, but loading it from a converted .jme format is under 1. Images would be the same way I’ld imagine. Is it worth while to put some kind of pre-compute image utility into jME?

what do you mean by “pre-loading” images?

I know from javascript term is to load them before they are used.

So in jME terms, you start loading some textures in another thread to make sure the rendering thread doesn’t stop and the whole thread issue starts again. But what if the texture-loading thread queue thing hasn’t reached a texture but its needed now as the player is seeing the untextured model?

As you can see, its becomes very confusing very easily.

So i was thinking that I go do some research regarding the loaders and see if I can comeup with something thats better than ImageIO. Im not guaranteeing it tho


Preloading would be similar to JmeBinaryConverter. With that, you preload the model so that it can be quickly loaded by jME. Similar concept with images.

@ DP - I think cep means saving it in its jme default state… ie, raw or the like. jpeg and other compressed formats are smaller in file size but require cpu to "decompress"

Well, i have 2 opinions regarding a customised image format for jME. And they are both opposites.

  1. We shouldn’t because it will become hard to produce one image, converting it to see it in the scenegraph

  2. We should, because it will provide a way for the user to encrypt their images so that the player can’t modify them. Much like .jpegimage of puppygames.

    What are your views on this?