Skip to content

Commit

Permalink
[Mono.Android] Use the faster java type name mapping (#1890)
Browse files Browse the repository at this point in the history
Fixes: #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.

This change also decreases JIT usage: in the XA template app,
*Compiled methods* is reduced from 1954 to 1880 methods.
  • Loading branch information
radekdoulik committed Jun 29, 2018
1 parent 0022b53 commit 67d5d26
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Mono.Android/Java.Interop/TypeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 67d5d26

Please sign in to comment.