I am currently working on a 2D Game that uses LWJGL, but I have stumbled across some serious performance issues. When I render more than ~100 sprites, the window freezes for a very small amount of time. I did some tests and I found out the following:
- The problem occurs with both Vsync enabled or disabled
- The problem occurs even if I cap the frames at 60
- The program is not just rendering less frames for a short time, the Rendering seems to actually pause
- There are no other operations like Matrix-Calculations that slow down the program
- I already have implemented batch rendering, but it does not seem to improve the performance
- The frequency of the freezes increases with the amount of Sprites
- My Graphics Card driver is up to date
- The problem occurs although the framerate seems to be quite acceptable, with 100 rendered sprites at the same time, I have ~1500 fps, with 1000 sprites ~200 fps
I use a very basic shader, the transformation matrices are passed to the shader via uniform variables each rendering call (Once per sprite per frame). The size of the CPU/GPU bus shouldn't be an issue.
I have found a very similar issue here, but none of the suggested solutions work for me.
This is my first question here, please let me know if I am missing some important information.
-verbose:gc
or use a memory profiler to get information about garbage collections happening and their pause times. – Kai Burjack