So I got a lot of my programming sorted out recently and managed to get a playable part of my game working. However, I saw horrid performance. Playing around with it for a while, I realized that it “goes away” after a while, doubling my FPS like a flip of a switch. The time it takes for it to start running decently is completely random. Sometimes it’s instant, sometime’s it’s more than a minute, which is obviously unacceptable.
First I obviously checked if anything else was running in the background. Nothing. Then I saw that my game’s java.exe dances at around 40-45% processor usage during this time, dropping to 25% (100% on one of four cores) when the game starts running as it should. The game doesn’t even create a single thread manually, so it should be impossible for it to use 100% on one core (25% in the task manager). I’m basically having a ghost thread draining CPU power in some weird way. I’ve tried to monitor threads with the profiler in Netbeans, but I can’t see any thread stopping or pausing when the lag disappears.
PS: Lol, Minecraft seems to get this too.