-
Notifications
You must be signed in to change notification settings - Fork 137
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
Cache style layers and sources #364
Comments
We have these values cached in the style layer and source classes already, just for consistency we decided to go through the gl-native to get the latest property values, since they could be modified in other places. Do you think we should always return the cached values? Or shall we introduce some flags to toggle the cache/without cache getters? Optionally, I think we could also expose the entire cached Property HashMap if that's helpful. |
Property values are one thing (that I didn't measure) and it does make sense to always ask GL-Native for that since it's the source of truth. The concern here is about obtaining the layer/source reference itself ( |
We could also use |
Hi @LukasPaczos I tried to read through the ticket again, I think the bottleneck is the call of I'm working on a PR to optimise it at #449 , do you want to do some benchmarks using a snapshot build? |
@pengdev happy to take it for a spin whenever you think it's ready 👍 |
@LukasPaczos thanks! I have triggered a snapshot, you can try |
@LukasPaczos I did some profiling on this change, in the same benchmark, the CPU utilisation seems to be improved Before( After( |
My benchmarks integrating the snapshot into the Nav SDK are even more promising given the frequency with which we call all the methods. A decrease of ~42 percentage points of time spent in the It still is not negligible, and now the bottleneck becomes the |
@LukasPaczos What's the code path to the |
Which relates to code found in https://github.com/mapbox/mapbox-navigation-android/blob/d10b9aeb7c079307d115ed2549e298337a450530/libnavui-maps/src/main/java/com/mapbox/navigation/ui/maps/internal/route/line/MapboxRouteLineUtils.kt#L129 |
Setting the |
@pengdev you can try updating the gradient every time the |
The performance of |
Stale, outdated. |
The pre-v10
Style
object cached layers and sources on the platform side to avoid having to fetch them from native whenever getter methods were called (refs mapbox/mapbox-gl-native#13484).In v10, this is not available anymore and as mapbox/mapbox-navigation-android#4425 (comment) shows, the constant recreation of style objects (
getStyleLayerProperties
in this case) causes a considerable performance penalty when called frequently (on each animation frame in this case).It'd be great if we can reintroduce some sort of platform caching or measure the performance of the native
getStyleLayerProperties
to see whether just crossing the JNI boundary and marshaling is the bottleneck or whether the native method itself could be optimized.cc @mapbox/maps-android @cafesilencio
The text was updated successfully, but these errors were encountered: