Even an empty openfl project consumes ~10% of cpu on Desktop platform. Is there anything that can be done?
OSX i5 2.6Ghz
What if you lower the FPS to 30, or enable vsync? Any changes?
No effect. Cpu load does not changed. I compile it in release mode.
Is this to C++, or to Neko? Does building with -Dcairo
have an effect?
C++, no effect.
I’ve checked in Instruments what is going on, here is a screenshot:
http://oi67.tinypic.com/mn0pwo.jpg
We would probably need a debug build to understand how the CPU time is being used, but for reference, on my ThinkPad I get 0.3% CPU on “DisplayingABitmap” and 2.0% CPU when adding -Dcairo (which triggers software rendering)
I wonder if OpenGL is being used? You can use this to know what’s in use:
trace (stage.window.renderer.type);
Without -Dcairo i got “OPENGL”
Is there any way to “sleep” rendering thread?
It looks like macOS forces vsync, interesting
In NME i got ~2.5% CPU usage for the same sample.
In XCODE Instruments you can see that lime.ndll causes this. ~10 functions are responsible for CPU usage.
50% is caused by:
_nextEventMatchingEventMask:untilDate:inMode:dequeue:]
This seems to help on macOS here:
Are you able to build from source?
Great !!!
It helped, now there is ~2.5-3.5% on mac.
I do not know if more optimizations are possible, but:
reason of 55%:
https://s11.postimg.org/fhk6pmdwx/Zrzut_ekranu_2016_10_12_o_06_13_47.png
reason of 24%:
https://s11.postimg.org/v4bg2zroz/Zrzut_ekranu_2016_10_12_o_06_12_30.png
reason of 16%:
https://s10.postimg.org/su6xdnhe1/Zrzut_ekranu_2016_10_12_o_06_19_08.png