Performance issues -- A cost not shown in profiler?

I started a new project and noticed a weird performance problem. The larger my game window, the lower the framerate, even though the profiler says that everything is the same.

To test, I created a new project with the “Empty Project” template, and only added a single script getting input to toggle the profiler or quit. For some reason vsync is waiting longer and longer based on the window size. I tried with vsync enabled and disabled in game.project, the result is essentially the same. It’s the same if I build from the editor or run a bundle.

As you can see, Engine.Sim and Profile.Draw stay the same, but the total actual frame time goes up and up. Is there something that could be taking up a lot of time that the profiler doesn’t show?

3 Likes

To be clear, the profiler does show the VSync.Wait increasing in each example you posted.

The vsync wait is timing the graphics “flip”, or swap buffers (graphics_opengl.cpp).

If you are on windows, that boils down to SwapBuffers(dc)

Since it takes more time, the more pixels it has to render/copy, I think that perhaps your graphics card is struggling a bit.

What platform is this? What graphics card do you use?

1 Like

What if you use the web profiler instead of the visual profiler? Same result?

1 Like

Ah, OK. I thought Vsync.Wait was literally just waiting.

I am running on somewhat minimum-spec hardware. Intel HD 4000, on Windows 7. But I run plenty of games at 60+ fps with no issues!

Some more testing, it seems to run fine when in fullscreen.

  • Fullscreen: enabled, width/height: 1600x900, vsync: on - It runs at 60fps no problem.
  • Fullscreen: enabled, width/height: 1600x900, vsync: off - still 60fps.
  • Fullscreen: disabled, width/height: 1600x900, vsync: off - 30 fps.
  • Fullscreen: disabled, width/height: 1600x900, vsync: on - scripts get a dt of 16.66ms, but the actual dt and the profiler say 33.33ms.
  • Toggling fullscreen with DefOS - 60fps fullscreen, 30fps maximized (at 1600x900).

If I “Build HTML5” with vsync off, this is what the profiler says (no matter the size), but the actual FPS is about 40 at 960x640 and 30-35 fullscreen at 1600x900.

@britzl OK, I tried the web profiler too, but it gives the same results.


void glfwSwapBuffers ( GLFWwindow * window )
This function swaps the front and back buffers of the specified window. If the swap interval is greater than zero, the GPU driver waits the specified number of screen updates before swapping the buffers.
- from the GLFW docs

Is it possible that it’s getting a weird interval?

Ah, OK. I thought Vsync.Wait was literally just waiting.

Well, it is waiting, on the graphics card and the OS.

You can play with the swap interval and frame cap as described here:

EDIT: This is an issue that pops up quite often, and we want to revisit this functionality soon.

2 Likes