Terrible performance on different computers

Started by pieisnotpi, April 08, 2017, 22:26:29

Previous topic - Next topic

pieisnotpi

I have a 2048 port, built on my LWJGL(3.1.2 build 13)-based engine, that I've been testing on different computers. On my development PC, CPU usage sits at around ~0.3% on a 4 GHz CPU. On my laptop, CPU usage can sit upwards of ~12% on a 2.5 GHz CPU. My dev PC has a GTX 1070, and the laptop has a GT 940m, both running the exact same drivers. Everything else (OS, Java v., etc.) is the same. The game is running on modern OpenGL with VSYNC enabled. What could be causing this huge performance difference? I've noticed when sampling CPU usage in VisualVM, the JNI.invokePV method has significant CPU usage (as pictured)



If this is the issue, how could I fix it?

spasi

The first step is identifying which function is responsible for the invokePV call. The most likely in this case is glfwSwapBuffers(), so you should verify that.

pieisnotpi

Quote from: spasi on April 08, 2017, 23:43:38
The first step is identifying which function is responsible for the invokePV call. The most likely in this case is glfwSwapBuffers(), so you should verify that.
Probably, due to the waiting associated with vsync and swapping buffers. After sampling CPU usage on my dev PC, where CPU usage was still ~0.5%, the sampled values were very similar to the above, so it's probably not invokePV.

EDIT: I've run some testing with and without vsync.

With vsync: Avg 48fps/10ms per frame, 7% cpu usage
Without vsync: Avg 60fps/0ms per frame, 3% cpu usage

With vsync, expected frame time is ~16ms per frame, though with a lower fps, this value can be distorted
Without vsync, cpu time of invokePV becomes negligible