jsettlers / settlers-remake

A Remake of "The Settlers III" for Windows, Linux, Mac and Android
http://www.settlers-android-clone.com
MIT License
356 stars 101 forks source link

Game causes exceptionally high CPU load inside two methods pertaining sound #754

Closed ewaldbenes closed 6 years ago

ewaldbenes commented 6 years ago

While fixing #742 I did some CPU and memory profiling. Two methods eat up 97% of the app's CPU consumption. I think this should be looked at. cpu-usage-high

paulwedeck commented 6 years ago

Where do you see high CPU consumption ?

ewaldbenes commented 6 years ago

I started profiling the Swing app with VisualVM because the game play felt laggy.

I mean "high CPU load" in terms of that two methods residing in the "sound" package use 97% of the app's CPU time compared to all other methods. Everything is happening in one core. Also the frame rate does not get higher than 25 fps.

This seems suspicious to me. I thought better to report it in case others expierence the same or want to have a look at it.

paulwedeck commented 6 years ago

You are looking at the wrong column. The sound stuff uses 97% of real time while its using just 101ms of cpu time. I made this screenshot in the Threads tab. image You can see there that the sound threads are mostly waiting. This (obviously) takes real time but does not take any CPU time. There are two ways of getting low fps in jsettlers:

ewaldbenes commented 6 years ago

Yeah, you're totally right. I looked into the wrong column. "Sound causing high CPU load"... That's why I was a little confused. Maybe I should have stopped working earlier. Please forgive! ^^