Ikemen-GO icon indicating copy to clipboard operation
Ikemen-GO copied to clipboard

Loss of frame rate with debug mode

Open potsmugen opened this issue 2 years ago • 5 comments

I've read that this would be fixed after 0.98.2, but it's still happening to me after compiling the latest versions, so I guess it's worth mentioning.

Whenever I activate the debug mode, I get a significant loss of frame rate, as shown here:

https://user-images.githubusercontent.com/107247004/174491906-3154612a-5068-4f83-98f5-498a3a404ae5.mp4

As a developer this is currently the most bothersome issue with the engine.

potsmugen avatar Jun 19 '22 16:06 potsmugen

Seems the problem is caused by the debug console log. POTS if you set DebugConsoleRows in config.json to 0 does the slowdown dissapear?

Windblade-GR01 avatar Jun 19 '22 22:06 Windblade-GR01

I forgot to mention that the more text there is on screen, the slower it gets. So that change in the config limits the problem but does not solve it.

Made a few more tests that will probably narrow down the problem:

  • Doesn't happen with "vanilla" Ikemen (although I need to disable OpenGL for that to even work)

  • I remembered that you mentioned some font rendering issue, so I tried adding a lot of text to the F1 message in the title screen and that also causes a slowdown.

  • One interesting thing when it happens is I can literally hear the hardware working harder. Like a humming sound that's not coming from the monitor. Also if I open the task manager, I can see that Ikemen Go normally takes up 7-8% of the CPU, but with debug mode on that number doubles. Memory usage seems to stay the same.

  • This should settle it: I tried Ikemen Go in my work laptop which is ironically slower but has a dedicated graphics card, and it does not happen.

So it's probably my Intel HD 3000. I know it's not a gaming laptop but it handles stuff much heavier than Ikemen without these issues.

potsmugen avatar Jun 20 '22 15:06 potsmugen

I have a similar issue where there's a lot of frame rate drop on the character select screen, though in my case, it's only on the character select screen, nowhere else. On the release build, there's no such lag. I can also confirm that it's purely the binary, as I've copied over the externals folder to the release build folder, and there's no issues.

My personal hypothesis is that there's some optimization going on when cross-compiling, as the release build has builds for all operating systems. I'm going to try and get docker working, but it also seems that the image is outdated, as that uses Golang 15.0 instead of the now required 18.0.

GaryCXJk avatar Jun 21 '22 16:06 GaryCXJk

Just to clarify, I have this issue with fonts both in 0.98.2 and the latest build.

potsmugen avatar Jun 21 '22 17:06 potsmugen

Lastest build is 0.98.2...

EgyLynx avatar Jun 23 '22 17:06 EgyLynx

I just noticed a random thing that may or not be useful, in that I don't have this issue with Ikemen GO 0.98.0

EDIT: Actually it's not 0.98 itself but the fact that it uses a SFF font and drawing those seems to be less demanding.

potsmugen avatar Mar 28 '23 07:03 potsmugen

The engine does a draw call (that means, 1 CGO call + 1 GPU call) for every glyph displayed here, and that's quite resource intensive. Only feasible way to optimize this I can think of is to implement batching in the renderer. I'd like to implement that myself, but I still don't have enough knowledge on OpenGL to do that.

I wonder how hard would it be to code a software renderer.

Lazin3ss avatar Jul 18 '23 05:07 Lazin3ss

Fixed by assemblaj's changes to font rendering (ikemen-engine/glfont#004).

potsmugen avatar Jun 03 '24 17:06 potsmugen