-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Performance of traffic island quest #5146
Comments
Here a clip of it happening. In the past those icons would show up instantly. |
This is really weirdly slow, especially considering that the data should alrealy be cached. |
So far I noticed this only with this quest. I'm on Samsung Galaxy S20FE running Android 13 with June 1 security updates |
I also wonder why the form itself takes 2s to show up. Showing of the form is independent from showing of the icons on the map. |
I just tried again and the same behavior happens after I clear app cache. If you want to try it yourself, node 10676274442 makes it very obvious. It's northern crosswalk of intersection of Ocean Avenue and Glenwood Road in Brooklyn, NYC. Screen_Recording_20230715_092856_StreetComplete.mp4 |
I can't reproduce it here, even on my 10 year old phone it takes less than 0.1 s to show the nearby crossings. For https://www.openstreetmap.org/node/8544895124 (the node from your first video) it's definitely slower. Here 67 nearby elements are highlighted, which takes more noticeable 0.3 s. But your S20 should be like 10 times faster than my S4 Mini...
It's not really independent. Adding hightlighted elements to the map (which is most of the 0.3 s above) is done on the main (UI) thread (via |
Yes, node/8544895124 is really noticable. |
Interesting, I'm wondering if that might be related to battery optimizations on Samsung... E.g. when it detects low load it switches you to lower-performance Cortex-A55, and when it senses the load starts to rise, it reenables high-power Cortex-A77 CPUs. Perhaps you can try playing with battery optimization settings, whitelisting StreetComplete to see if that helps? |
But then wouldn't this be a problem with every quest and otherwise overall app performance, and not just crossing island quest? |
Oh, yeah. I was about to suggest that, but I see you edited the post. Posting the update to tangram-es was never intended to be on the main thread. |
So just change StreetComplete/app/src/main/java/de/westnordost/streetcomplete/screens/main/MainFragment.kt Line 1083 in 5646ea1
to viewLifecycleScope.launch(Dispatchers.Default) ?
What to do with the actual issue... I have no idea. It very much looks like some Samsung optimization gone wrong, especially since it doesn't happen when a profiling tool is enabled. |
Maybe there's some suboptimal regex or tag matching going on that significantly slows things down? |
All the tag matching stuff is already done before you see the first icon, so we can exclude this. On my device, the (by far) slowest part after finding the crossings is putting the icons on the map. It just takes a few milliseconds per icon, but e.g. 67*3 ms = 201 ms. Incidentally this is also the only part where the GPU is used (via the map library. |
I just tried this quest on my LG V30 and noticed the same slow down, but it doesn't happen as consistently. Recording_2023-07-19-08-42-17.1.mp4 |
And stranger still, on my LG V30 this slowness guess away when I start screen recording. I recorded it with my other phone but can't upload here. I posted it on OSMUS slack server in #streetcomplete channel. |
Well, I think you can stop researching this because it will have something to do with tangram-es which is a bit of a black box (viewed from our side, it's open source alright) and not maintained anymore. So, we are not in a position to fix this anyway. What we can fix is to make sure that displaying of the stuff on the map is done in a separate thread as showing the form, so the slowdown does have much less of a negative effect.
Err, I guess. I didn't look at the code yet. Would make sense to check for other places where data is put on the map whether it is done in a background thread. |
Overlay, quest pins and downloaded area managers already do it in background. Is there anything else? |
Maybe the updates of the view direction and location? |
Direction is updated on StreetComplete/app/src/main/java/de/westnordost/streetcomplete/util/location/FineLocationManager.kt Line 22 in 967d2c4
|
Hm I guess that's okay then. |
So, @Helium314 made it so that updates on the map do not block the initialization of the UI which should somewhat alleviate the UX issue described here, wherever the issue is coming from. |
I just noticed when I tap on crossing island, surrounding traffic lights icons take 1-2 seconds to appear. This was never so slow. They would always appear instantly. I haven't actively used SC in a version or two so can't tell when exactly it started happening.
How to Reproduce

Tap on crossing island quest
Expected Behavior
Related icons instantly appear.
Versions affected
53.3 (possibly earlier too)
The text was updated successfully, but these errors were encountered: