Loading fonts (love.graphics.newFont(font, size)) takes quite a long time, but only on some devices. It doesn't seem to be dependent on their overall performance, as it behaves differently on similarly powerful ones.
Approximate full game loading times on different devices (measured from launch to the first rendered frame):
- 1s on Xiaomi Mi 9 (Android 10 "MIUI")
- 1s on Xiaomi redmi note 9 pro (Android 10 "MIUI")
- 2s on Xiaomi redmi 5a (Android 7 "MIUI")
- 3s on Xiaomi Redmi Note 8T (Android 10 "MIUI")
- 10s on Nokia 9 (Android 10 "Android One")
- 13s on Nokia 5.1 PLUS (Android 10 "Android One")
(I've also got some reports of slow loading from other people (friends of friends), but unfortunately I don't know exact times and what devices are they using.)
After finding out that font loading is the main issue, I've made more precise measurements on my Nokia 9:
Code: Select all
resources.font = {}
print("menu")
resources.font.menu = love.graphics.newFont("fonts/dudeludel.ttf", 64)
print("menuBig")
resources.font.menuBig = love.graphics.newFont("fonts/dudeludel.ttf", 128)
print("menuArrow")
resources.font.menuArrow = love.graphics.newFont("fonts/poetsen.ttf", 275)
print("menuCounter")
resources.font.menuCounter = love.graphics.newFont("fonts/poetsen.ttf", 80)
print("done")
Code: Select all
2021-02-17 19:44:06.945 11820-12029/org.ohaidev.snek I/SDL/APP: [LOVE] menu
2021-02-17 19:44:07.375 11820-12029/org.ohaidev.snek I/SDL/APP: [LOVE] menuBig
2021-02-17 19:44:09.115 11820-12029/org.ohaidev.snek I/SDL/APP: [LOVE] menuArrow
2021-02-17 19:44:12.589 11820-12029/org.ohaidev.snek I/SDL/APP: [LOVE] menuCounter
2021-02-17 19:44:13.024 11820-12029/org.ohaidev.snek I/SDL/APP: [LOVE] done
- dudeludel (18 KB)
- poetsen(169 KB)
It looks like it takes longer to load a bigger font, which is understandable.
Why is it almost instant on some devices and so slow on others though, I have no idea. Does anyone know what may be causing it?
P.S. On my PC it loads almost instantly. I thought it was because of JIT being enabled on PCs by default, but jit.off() doesn't really change anything. At the moment I assume it doesn't affect PCs because of their higher overall performance, but I don't really know about that. Anyway, I've tagged the thread "Android(?)" because I'm not sure if it actually only happens on Android devices.