Author Topic: How to effectively use the cache of cup/gpu in java/jPCT-AE?  (Read 2074 times)

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
How to effectively use the cache of cup/gpu in java/jPCT-AE?
« on: April 26, 2013, 04:37:46 am »
In C, i know some tricks to improve the cache hitting. But i'm not very clear how JVM/DVM work, so i don't know how to improve this in java. And i know little about GPU(and it's cache)。

Any suggestions or best practices? And could jPCT-AE benefit from mulit-cores cpu?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: How to effectively use the cache of cup/gpu in java/jPCT-AE?
« Reply #1 on: April 26, 2013, 08:16:14 am »
I haven't found any patterns in data structures or code that seemed to be more cache friendly then others. When using the GPU, i would simply say that less is more, i.e. if you reduce texture size or are using compressed textures, performance should be better, but it's hard to tell how much of this is caused by better cache usage.
Regarding multi-cores: No, not directly. The overall experience will of course improve, but the engine's core is single threaded. If you want to benefit from multiple cores, you can try to do so in your game logic, but to be honest, i wouldn't expect too much. I tried some things in my own game and it wasn't really worth it. All it did was to empty the battery even faster...

Offline kiffa

  • long
  • ***
  • Posts: 199
    • View Profile
Re: How to effectively use the cache of cup/gpu in java/jPCT-AE?
« Reply #2 on: April 26, 2013, 03:35:03 pm »
Thanks, for specific CPU(architecture), in specific situation, there will be some methods to improve the cache hitting, but as you say, there is not a common pattern.

And about the battery, i found my game has a very high power consumption. Not precise(no test), just by feel,  seems the game "Temple run" which was developed with Unity3D is more power saving than my game(was developed with jPCT-AE). I don't see why, maybe i should do a test.

And for saving power, i limit the FPS by Thread.sleep(), any other suggestions? 

Another question, “many small textures” VS “one large texture”, which has the better performance?