You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Limit JNI calls in nativePixelForLatLng & nativeLatLngForPixel #5104
Each JNI method execution above results in 4 JNI rounds trips:
JNI method itself
jni::GetField
jni::GetField
jni::NewObject
Following the guidelines related to JNI and mentioned in the Google I/O session related to NDK, we should limit the amount of JNI calls inside one JNI method. In case from above this would result in removing the jni::GetField/ jni::NewObject items and replacing jobject pixel and jobject latlng with multiple parameters.
Activity
tobrun commentedon Jun 20, 2016
I started looking into profiling small changes:
Remove JNI calls to get LatLng values:
Profiling execution time with 1000 calls:
Remove PointF object creation
Profiling execution time with 1000 calls:
tobrun commentedon Jun 20, 2016
Remove JNI calls to get Pixel values:
Profiling execution time with 1000 calls:
Replace java object creation by array
Profiling execution time with 1000 calls:
[android] #5104 - make nativePixelForLatLng faster (74ms to 57ms)
[android] #5104 - make nativeLatLngForPix faster (52ms - 45ms).
tobrun commentedon Jul 5, 2016
I'm now looking into the possibility to used a cached field setup for high trafficking jni calls and see if that is faster.
update: this approach was slower
tobrun commentedon Jul 5, 2016
Closed with #5412 and squashed into 2bf4e20