From 751b6ef8acca48bb58f35b0d55a8920464e28b82 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Wed, 27 Jun 2018 15:49:17 +0200 Subject: [PATCH] [Mono.Android] Use the faster java type name mapping This fixes https://github.com/xamarin/xamarin-android/issues/1831 Make sure we use the code path, which uses the `typename.*` maps. It is much faster than `JavaNativeTypeManager.ToJniName`. Tested with x86 emulator again. It saves 17ms (from 18ms to 1ms) in XA template and 26ms (from 28ms to 2ms) in XamlSamples app. So it scales well. It also decreases JIT usage. XA template: *Compiled methods* 1954 to 1880. --- src/Mono.Android/Java.Interop/TypeManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mono.Android/Java.Interop/TypeManager.cs b/src/Mono.Android/Java.Interop/TypeManager.cs index 0d94d275cd5..fb620addb9b 100644 --- a/src/Mono.Android/Java.Interop/TypeManager.cs +++ b/src/Mono.Android/Java.Interop/TypeManager.cs @@ -309,7 +309,7 @@ internal static object CreateProxy (Type type, IntPtr handle, JniHandleOwnership public static void RegisterType (string java_class, Type t) { - string jniFromType = JavaNativeTypeManager.ToJniName (t); + string jniFromType = JNIEnv.GetJniName (t); lock (jniToManaged) { Type lookup; if (!jniToManaged.TryGetValue (java_class, out lookup)) {