I made a raycasting engine with wall textures. Before adding the texture the engine was silky smooth. With textures it has small lags (or stutters) when i move around and i would like to know why. My code is not super clean so im not providing it (yet). I'm looking for general tips on where to start when you want to optimize for performances. It's the first time i have to do this.

I monitored my pc performance while the engine was running. My CPU had very low usage and none of my cores were over 30%. Memory and disk usage were all fine. GPU was at 0% (its in 2d). All wall textures are loaded in memory at game launch so in theory my engine should not have to read from disk while running.

Im using Eclipse and the code is in Java + Swing.

  • 2
    \$\begingroup\$ Searching "profile java eclipse" is turning up lots of existing guides about how to profile a java program. What have you tried so far based on your research of this material? \$\endgroup\$ – DMGregory May 31 '20 at 20:26
  • \$\begingroup\$ I dont know what profiling means. I never had to do any optimization, only step by step debugging. Just read some websites and it seems to be exactly what i was looking for. Would you mind making a post of your comment so i can select it as the answer pls? \$\endgroup\$ – Frédéric Bélanger Jun 4 '20 at 12:49
  • \$\begingroup\$ I'd recommend you continue researching profiling until you find a method that works for you, then post your method as an answer. Your first-hand experience or examples will likely be more useful to future game developers who are in a similar stage in their journey. \$\endgroup\$ – DMGregory Jun 4 '20 at 12:54
  • \$\begingroup\$ Will do so. Thank you for your help, really appreciated. \$\endgroup\$ – Frédéric Bélanger Jun 4 '20 at 13:45

I used Jprofiler and found out i had many waiting/blocked threads. Using this tip from another user i was able to find out the problematic calls in my code:

"Go to the call tree view, record CPU data and set the thread status selector to "Blocking", than you see in which call stacks the blocking occurs.Detailed analysis of blocking situations is available in the "Monitors & Locks" view section"


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.