GTK4 and libadwaita startup perfomance regression/problems
Context
After some time of using mixed set of GTK3 and libadwaita apps, i started to notice some startup delay difference. While GTK3 apps launch instantly, libadwaita apps take 2-3 seconds to launch for me. I think this is not a good behavior so i started to investigate the problem. After some issues searching i didn't find anything about it. So i made my own tests with gtk3, gtk4 and libadwaita performance comparison and made some conclusions.
So my startup startup performance tests
Tests setup info
- Distribution: Fedora 36
- CPU: Intel i5 8250U
- GPU1: Intel UHD 620
- GPU2: NVIDIA mx150 (proprietary drivers)
- RAM: 8 GB (Single-channel)
- Storage: M2 Samsung evo ssd
- Desktop environment: GNOME 42
- Display server: wayland
Steps used for measurements
- Launch GNOME Sysprof
- Set "Launch Application"
- Start recording
- Wait till app window appears and close it immediately
- Open "Timings" section in captured results
- Find functions which took the longest work duration
/bin/gtk3-demo
No noticeable slow downs. Timings are all mostly equal in duration.
/bin/gtk4-demo
A bit slowdown at launch. Noticeable slowdown functions from timings:
- g_main_context_iterate — Context 0x55e2679ab8a0, blocking ⇒ dispatched
Duration: ~444 msec
/bin/adwaita-1-demo
Noticeable delay in launch. Noticeable slowdown functions from timings:
-
g_main_context_iterate — Context 0x559457abdda0, blocking ⇒ nothing
Duration: ~ 738 msec -
icon theme load — Papirus-Dark
Duration: ~ 276 msec -
css validation
Duration: ~ 314 msec -
icon theme load — Papirus-Dark
Duration: ~ 291 msec -
g_main_context_iterate — Context 0x559457ace650, blocking ⇒ dispatched
Duration: ~ 1 second
Yes, i noticed that custom Icon pack takes time to load. So after this test i disabled it.
/bin/adwaita-1-demo (after disabling custom Icon pack)
Still noticeable delay in launch. Noticeable slowdown functions from timings:
- g_main_context_iterate — Context 0x55f795bcf650, blocking ⇒ dispatched
Duration: ~ 1.1 seconds
/bin/gnome-control-center (Custom Icon pack disabled)
Big noticeable delay in launch. Noticeable slowdown functions from timings:
-
g_main_context_iterate — Context 0x5555b4c2e050, blocking ⇒ dispatched
Duration: ~ 2.6 seconds -
g_main_context_iterate — Context 0x5555b4bf47f0, blocking ⇒ dispatched
Duration: ~ 2.2 seconds
My Conclusions
- GTK4 and libadwaita performance startup regression/problems with g_main_context_iterate function
- libadwaita performance regression with custom Icon packs. Yes, i know about Please don’t theme our apps