Recurring Lags (Mouse Event) on Neko & CPP

Hello OpenFL Community!

I haven’t used Haxe/OpenFL in a while. So for a new project, I got everything updated and now I have this weird lag issue I can’t get rid anymore.

Basically once a second (or so) the FPS goes down to <10, then back up to >100FPS for a frame (in that frame it creates 300+ Floats for some mouse events) and back to the normal framerate (whatever i defined).

This happens constantly and with the most basic applications. Opening a blank window/project is enough (for me) to trigger this behavour.

There are no issues with HTML5. But Neko and CPP act like that.

I’ve asked in 2 different Discords in the last days and did not get further than people speculating about garbage collection, which turned out to be likely false.

Any ideas what this could be? And even more how i could get rid of it?

Did you try to set hardware = false in project.xml ?
<window hardware="false"/>

Thanks for the suggestions. Sorrily this did not change anything about the lag issue.

Well it could be our main loop algorithm, or it could be that it is slowing down (say for garbage collection)

Tuning the main loop is really difficult

This was the most recent change:

or this one:

(changes to this file require a dev version of Lime and lime rebuild <target> to recompile the lime NDLL library)

Just compiled it from scratch with the current lime development branch, but still :confused:

From what i can tell with hxscout there is no garbadge collection happening near the lags. Garbadge collection only happens rarely, especially on a plain blank canvas, but the lags keep on going in a recurring fashion.

What happens if you try using different <window fps="" /> values?

I’ve tried all between 10 and 100 and the lags stay about at the same rate.

Do you have some code connected to Event.ENTER_FRAME ?
At example if you add function update as Lib.current.stage.addEventListener(Event.ENTER_FRAME, update);

Sorrily no. It also happens with the most basic examples (i.e. just drawing one static bitmap to a black screen). I begin to suspect this is because i am on the lower spectrum of modern computing power.

I am using a “Intel® Core™ i7-6700 CPU @ 3.40GHz” and the onboard GPU “Intel® HD-Grafik 530” which i know is not high end, however it works for 99% of my use cases.

Plus i have build and released a game about a year ago on the same computer and never run into any issues like this.

Just as a idea , if you still keep the old OpenFL and Lime versions ( at example in C:\HaxeToolkit\haxe\lib\ , you can change .current file to point to that version ( from a year ago ) and after that to check if the problem still exist and is connected with the newest OpenFL / Lime or is something else.

What are you using to measure the frame rate? openfl.display.FPS?

That, HXScout or Flixels Debug tool. They all show kinda similar results (as in constant defined rate, then peak to >100, then drop to <10). I would not even mind slight FPS drops but even the mouse movement is stopped and there are very visible animation lags.

While downgrading and upgrading i kinda broke hxtelemetry support so i can’t create a dump right now (no idea really… https://paste.ofcode.org/r6mNcX6MeV8rdquzCuY6AT)

No idea how i can help/get closer to the issue otherwise.

Edit:// I also setup HL and to my surprise also the very same issue. No idea why HTML5 just works.

Did you tried to create sample project with openfl create DisplayingABitmap and run it ?
Also try to avoid Flixel and openfl.display.FPS in the test.