Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow startup of the nightly comparing to release #18168

Closed
Nine-Tailed opened this issue Sep 15, 2023 · 18 comments
Closed

Slow startup of the nightly comparing to release #18168

Nine-Tailed opened this issue Sep 15, 2023 · 18 comments

Comments

@Nine-Tailed
Copy link
Contributor

I recently noticed that the nightly build of osmand runs very slowly (10-12 second's) compared to version 4.6.0 from google play or version 4.5.10 from fdroid (3 second's).
I did a reset of the app and then uninstalled and reinstalled it. But the night build still takes a long time to start. I made several rollbacks, the last one to OsmAnd~ 4.5.0#35827m, release date: 2023-04-21, but the result is the same.
I suspect it's related to the phone model, based on a small poll in the telegram chat.
Below is a link to a video where I run the nightly build of the app first, and then the google play version.
https://t.me/ruosmand/136939

OsmAnd Version: OsmAnd~ 4.6.0#769m, дата выпуска: 2023-09-15
Android/iOS version: 13
Device model: poco f3 (xiaomi)
Crash-Logs: ?
@zipav
Copy link

zipav commented Oct 9, 2023

OsmAnd Nightly 4.6.0#849m, released: 2023-10-09

video_2023-10-10_01-19-13.mp4

@zipav
Copy link

zipav commented Oct 10, 2023

OsmAnd 4.6.2, released: 2023-09-27

When compared to the release version, launching the release version is almost 5 seconds faster:

video_2023-10-11_02-10-07.mp4

@vshcherb
Copy link
Member

Not actually reproduced on my device probably it's related to tracks or not. Did you try latest beta release?

@Nine-Tailed
Copy link
Contributor Author

Nine-Tailed commented Oct 14, 2023

Not actually reproduced on my device probably it's related to tracks or not. Did you try latest beta release?

I tried a clean installation of the nightly build, the first launch of Osmand without a map took 7 seconds. Then I downloaded one map and Osmand began to load in about 10-11 seconds. The version from the google play loads in 4 seconds.
Today I repeated the experiment with a clean install, nothing changed.
Nightly version: OsmAnd~ 4.6.0#871m, дата выпуска: 2023-10-13
Google play version: OsmAnd 4.6.3, дата выпуска: 2023-10-12

@vshcherb
Copy link
Member

Release version might be precompiled cause they are installed from Google Play.
However I tested 3 versions: nightly, plus, free and it looks like they start independently fast 5-6 seconds. So I can't confirm it, we need to have comparable log files to identify the issue.

@vshcherb vshcherb changed the title Very slow startup of the nightly build Slow startup of the nightly comparing to release Oct 19, 2023
@Nine-Tailed
Copy link
Contributor Author

I can attach logcats after starting applications for nightly builds and free versions from Google Play.
logcat_gplay.log.txt

logcat_nightly.log.txt

@vshcherb
Copy link
Member

Logs are identical (please attach again)
Nightly log - 15 seconds

10-20 20:28:06.795 16088 16088 I System.out: Time to start application 1687 ms. Should be less < 800 ms
10-20 20:28:06.919 16088 16088 I System.out: Time to init plugins 124 ms. Should be less < 800 ms
10-20 20:28:11.336 16088 16139 I System.out: Initialized INIT_RENDERERS in 4541 ms
10-20 20:28:12.501 16088 16088 I System.out: Initialized ROUTING_CONFIG_INITIALIZED in 1164 ms
10-20 20:28:14.521 16088 16139 I System.out: Initialized NATIVE_OPEN_GL_INITIALIZED in 2021 ms
10-20 20:28:14.911 16088 16139 I System.out: Initialized POI_TYPES_INITIALIZED in 390 ms
10-20 20:28:14.989 16088 16139 I System.out: Initialized ASSETS_COPIED in 78 ms
10-20 20:28:15.223 16088 16139 I System.out: Initialized MAPS_INITIALIZED in 233 ms
10-20 20:28:16.369 16088 16139 I System.out: Initialized NATIVE_INITIALIZED in 1147 ms
10-20 20:28:17.924 16088 16139 I System.out: Initialized FAVORITES_INITIALIZED in 1555 ms
10-20 20:28:18.487 16088 16139 I System.out: Initialized POI_FILTERS_INITIALIZED in 563 ms
10-20 20:28:20.996 16088 16139 I System.out: Initialized INDEX_REGION_BOUNDARIES in 2509 ms
10-20 20:28:21.340 16088 16139 I System.out: Initialized LOAD_GPX_TRACKS in 344 ms
10-20 20:28:21.343 16088 16139 I System.out: Initialized SAVE_GPX_TRACKS in 3 ms
10-20 20:28:21.343 16088 16139 I System.out: Initialized RESTORE_BACKUPS in 0 ms

@Nine-Tailed
Copy link
Contributor Author

logcat_nightly.log.txt

logcat_gplay.log.txt

@vshcherb
Copy link
Member

Google Play - 3 seconds

10-22 17:30:29.463  3999  3999 I System.out: Time to start application 953 ms. Should be less < 800 ms
10-22 17:30:29.525  3999  3999 I System.out: Time to init plugins 62 ms. Should be less < 800 ms
10-22 17:30:29.561  3999  4065 I System.out: Initialized INIT_RENDERERS in 98 ms
10-22 17:30:30.196  3999  3999 I System.out: Initialized ROUTING_CONFIG_INITIALIZED in 635 ms
10-22 17:30:31.370  3999  4065 I System.out: Initialized NATIVE_OPEN_GL_INITIALIZED in 1174 ms
10-22 17:30:31.388  3999  4065 I System.out: Initialized POI_TYPES_INITIALIZED in 17 ms
10-22 17:30:31.416  3999  4065 I System.out: Initialized ASSETS_COPIED in 29 ms
10-22 17:30:31.485  3999  4065 I System.out: Initialized MAPS_INITIALIZED in 69 ms
10-22 17:30:32.021  3999  4065 I System.out: Initialized NATIVE_INITIALIZED in 536 ms
10-22 17:30:32.155  3999  4065 I System.out: Initialized FAVORITES_INITIALIZED in 134 ms
10-22 17:30:32.201  3999  4065 I System.out: Initialized POI_FILTERS_INITIALIZED in 46 ms
10-22 17:30:32.920  3999  4065 I System.out: Initialized INDEX_REGION_BOUNDARIES in 719 ms
10-22 17:30:32.920  3999  4065 I System.out: Initialized LOAD_GPX_TRACKS in 0 ms
10-22 17:30:32.923  3999  4065 I System.out: Initialized SAVE_GPX_TRACKS in 3 ms
10-22 17:30:32.923  3999  4065 I System.out: Initialized RESTORE_BACKUPS in 0 ms

@vshcherb
Copy link
Member

Well the answer pretty clear there is no JIT optimization on APK level https://source.android.com/docs/core/runtime/jit-compiler (it is done only once uploaded to google play).
INIT_RENDERERS is 10 times faster same as other parsers.

@vshcherb
Copy link
Member

So unfortunately I think it will be waste of time to try to optimize "debug" level code when "runtime" works fine

@Nine-Tailed
Copy link
Contributor Author

I'm not familiar with android architecture. But why then are there no problems with builds from fdroid? And in general it’s strange that nightly builds show different speeds on different phones.

@vshcherb
Copy link
Member

But why then are there no problems with builds from fdroid? And in general it’s strange that nightly builds show different speeds on different phones.
I can't answer the question, more like a question to Android developers

@vshcherb
Copy link
Member

vshcherb commented Nov 7, 2023

Slow startup nightly log:

10-22 17:29:52.340  3034  3034 I System.out: Time to start application 1732 ms. Should be less < 800 ms
10-22 17:29:52.497  3034  3034 I System.out: Time to init plugins 156 ms. Should be less < 800 ms
10-22 17:29:56.724  3034  3165 I System.out: Initialized INIT_RENDERERS in 4384 ms
10-22 17:29:57.718  3034  3034 I System.out: Initialized ROUTING_CONFIG_INITIALIZED in 994 ms
10-22 17:30:00.538  3034  3165 I System.out: Initialized NATIVE_OPEN_GL_INITIALIZED in 2820 ms
10-22 17:30:00.958  3034  3165 I System.out: Initialized POI_TYPES_INITIALIZED in 420 ms
10-22 17:30:00.995  3034  3165 I System.out: Initialized ASSETS_COPIED in 37 ms
10-22 17:30:01.267  3034  3165 I System.out: Initialized MAPS_INITIALIZED in 272 ms
10-22 17:30:02.592  3034  3165 I System.out: Initialized NATIVE_INITIALIZED in 1325 ms
10-22 17:30:04.706  3034  3165 I System.out: Initialized FAVORITES_INITIALIZED in 2114 ms
10-22 17:30:05.251  3034  3165 I System.out: Initialized POI_FILTERS_INITIALIZED in 545 ms
10-22 17:30:07.970  3034  3165 I System.out: Initialized INDEX_REGION_BOUNDARIES in 2719 ms
10-22 17:30:08.300  3034  3165 I System.out: Initialized LOAD_GPX_TRACKS in 330 ms
10-22 17:30:08.305  3034  3165 I System.out: Initialized SAVE_GPX_TRACKS in 5 ms
10-22 17:30:08.305  3034  3165 I System.out: Initialized RESTORE_BACKUPS in 0 ms

@vshcherb
Copy link
Member

vshcherb commented Nov 7, 2023

10-22 17:30:29.463  3999  3999 I System.out: Time to start application 953 ms. Should be less < 800 ms
10-22 17:30:29.525  3999  3999 I System.out: Time to init plugins 62 ms. Should be less < 800 ms
10-22 17:30:29.561  3999  4065 I System.out: Initialized INIT_RENDERERS in 98 ms
10-22 17:30:30.196  3999  3999 I System.out: Initialized ROUTING_CONFIG_INITIALIZED in 635 ms
10-22 17:30:31.370  3999  4065 I System.out: Initialized NATIVE_OPEN_GL_INITIALIZED in 1174 ms
10-22 17:30:31.388  3999  4065 I System.out: Initialized POI_TYPES_INITIALIZED in 17 ms
10-22 17:30:31.416  3999  4065 I System.out: Initialized ASSETS_COPIED in 29 ms
10-22 17:30:31.485  3999  4065 I System.out: Initialized MAPS_INITIALIZED in 69 ms
10-22 17:30:32.021  3999  4065 I System.out: Initialized NATIVE_INITIALIZED in 536 ms
10-22 17:30:32.155  3999  4065 I System.out: Initialized FAVORITES_INITIALIZED in 134 ms
10-22 17:30:32.201  3999  4065 I System.out: Initialized POI_FILTERS_INITIALIZED in 46 ms
10-22 17:30:32.920  3999  4065 I System.out: Initialized INDEX_REGION_BOUNDARIES in 719 ms
10-22 17:30:32.920  3999  4065 I System.out: Initialized LOAD_GPX_TRACKS in 0 ms
10-22 17:30:32.923  3999  4065 I System.out: Initialized SAVE_GPX_TRACKS in 3 ms
10-22 17:30:32.923  3999  4065 I System.out: Initialized RESTORE_BACKUPS in 0 ms

@vshcherb
Copy link
Member

Nighlty starts 5x times slower on my devices 3s vs 15s and I didn't find any workaround yet :-( https://www.reddit.com/r/android_beta/comments/14yh35l/this_is_how_to_force_optimize_android_beta_or/ - so it becomes very inconvenient to use nighlty probably we will be forced to use public beta more often

@Nine-Tailed
Copy link
Contributor Author

Good news, today's nightly build of Osmand~ 4.7.0#1765m is fast again.

@sonora
Copy link
Member

sonora commented Mar 6, 2024

@vshcherb Sorry for only just now discovering this thread: In my experience, there is zero performance difference between a release build and a debug build if only in build.gradle you specify this for the debug build (I get like 5 sec startup time with dozens of maps present):

Screenshot_20240306-220335_Firefox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants