it’s not just the app, these days it involves at least sadboxing (in addition to all other inefficiencies along the way). it could also be that you’re running out of physical memory (especially if android runtime is running)
EDIT: the below is wrong, sailjail does not delay app startup, at least not by the huge factor i found. it delays on exiting with sigterm, which is slightly annoying.
to add to what slava is saying, sailjail is the complete, correct answer to your question.
i ran the following commands, watching the phone and hitting ctrl+c as soon as my alarm loads (i have just one alarm). i took the averages of 10 tries each. it’s fully twice as slow with sailjail to load
time jolla-clock = 1.51s (median 1.56s, min 1.48s, max 1.72s)
time /usr/bin/sailjail -p jolla-clock.desktop /usr/bin/jolla-clock = 3.06s (median 3.21s, min 3.02s, max 3.89s)
I would love to see startup flamegraph of various SFOS apps. But my Xperia 10.II have no linux-utils available Does C2 have it? Anyone who is able to run “perf record” and generate flamegraph from it?
sorry folks, my test was flawed. i did not notice until repeating the test with other apps, but the huge sailjail overhead is on app exit.
i re-did the test with this setup: pkill -f -9 /usr/bin/jolla-clock ; time sh -c 'sh -c "/usr/bin/jolla-clock &"; read'
pkill -f -9 /usr/bin/jolla-clock ; time sh -c 'sh -c "/usr/bin/sailjail -p jolla-clock.desktop /usr/bin/jolla-clock &"; read'
and i got 1.40s for no sailjail and 1.56s for sailjail. sailjail must be doing some cleanup on exit, at least on sigterm. there is some overhead for startup, but it seems to be constant and small.
During my previous experiments with OSMScout startup delay I found that QML scene compilation takes pretty long, when you have non-trivial UI. It may be solved by distribution of pre-compiled QML files. But it is available from Qt 5.10 if I remember correctly and we are stuck on 5.6.
BUT clock UI is pretty simple (didnt ispect the sources), I would not expect that it is the bottleneck here.
I remember that app start was pretty instant on Jolla One because of launcher pre-loading. But it was abandoned because of Sailjail.
If the app needs to register names, services it can take a bit. Even more so if whatever causes starting things that provide DBus services.
For example, if there is a daemon providing org.foo.Service but it is not running and Sailjail/Firejail for app bar includes something like dbus-user.talk org.foo.Service, this will cause the daemon to be launched before app bar is displayed.