Furthermore,

In:

    [Register("bulkInsert", 
"(Landroid/net/Uri;[Landroid/content/ContentValues;)I", "")]
    public int BulkInsert(Android.Net.Uri url, ContentValues[] values)
    {
      if 
(ContentResolver.id_bulkInsert_Landroid_net_Uri_arrayLandroid_content_ContentValues_
 == IntPtr.Zero)
        
ContentResolver.id_bulkInsert_Landroid_net_Uri_arrayLandroid_content_ContentValues_
 = JNIEnv.GetMethodID(ContentResolver.class_ref, "bulkInsert", 
"(Landroid/net/Uri;[Landroid/content/ContentValues;)I");
      IntPtr num1 = JNIEnv.NewArray<ContentValues>(values);
      IntPtr handle = this.Handle;
      IntPtr jmethod = 
ContentResolver.id_bulkInsert_Landroid_net_Uri_arrayLandroid_content_ContentValues_;
      JValue[] jvalueArray = new JValue[2];
      int index1 = 0;
      jvalueArray[index1] = new JValue((IJavaObject) url);
      int index2 = 1;
      jvalueArray[index2] = new JValue(num1);
      int num2 = JNIEnv.CallIntMethod(handle, jmethod, jvalueArray);
      if (values != null)
      {
        JNIEnv.CopyArray<ContentValues>(num1, values);
        JNIEnv.DeleteLocalRef(num1);
      }
      return num2;
    }

Why is the array copied back in after the function call? values shouldn't have 
changed.  url certainly doesn't get the same treatment.

Jeremy

From: monodroid-boun...@lists.ximian.com 
[mailto:monodroid-boun...@lists.ximian.com] On Behalf Of Jeremy A. Kolb - 
ARA/NED
Sent: Thursday, January 03, 2013 4:18 PM
To: monodroid@lists.ximian.com
Subject: [mono-android] Copying data between Dalvik and Mono... major slowdown.

I'm getting killed with bulk inserts  via ContentResolver because of the 
marshaling of ContentValues[] between C# and Android right before it calls into 
my ContentProvider (C# again).  It looks like that must be two copies.

I have large arrays (a couple of thousands of elements).  Is there any way to 
make this faster short of not using the android content provider interfaces?

Jeremy
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to