axmolengine / axmol

Axmol Engine – A Multi-platform Engine for Desktop, XBOX (UWP) and Mobile games. (A fork of Cocos2d-x-4.0)
https://axmol.dev
MIT License
922 stars 205 forks source link

FontFreeType performance issues on Android #2063

Closed smilediver closed 3 months ago

smilediver commented 3 months ago

We have big performance issues on Android when creating Labels. It looks like the issue is that FontFreeType is not loading whole font file into memory, but is reading it like a regular file from APK. Reading from APK seems to be super slow (maybe only random seeking?). Profiler shows that it takes 8ms for reading glyph data. I have suspicion that it might be decompressing whole font file each time it is accessed.

Screenshot 2024-07-31 at 17 39 46
halx99 commented 3 months ago

Check your build.gradle does the noCompress contains ttf, ttc

https://github.com/axmolengine/axmol/blob/dev/templates/common/proj.android/app/build.gradle#L83

smilediver commented 3 months ago

That solved the issue. Thanks!