[Mono-bugs] [Bug 357947] New: Performance problem with System.Data

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Feb 1 06:16:00 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=357947


           Summary: Performance problem with System.Data
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Data
        AssignedTo: bnc-blr-team-mono at forge.provo.novell.com
        ReportedBy: informatique.internet at fiducial.fr
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Hi,

I'm facing huge performance difference with System.Data between MS.NET and MONO
especially when removing rows in a datatable

Try this test case :

using System;
using System.Collections;
using System.Data;

namespace TestRemoting
{
        class MainClass
        {

                public static void DataRowViewTest()
                {
                        DateTime begin=DateTime.Now;
                        DataTable dt=new DataTable();
                        dt.Columns.Add("id",typeof(string));
                        dt.Columns.Add("parentid",typeof(string));
                        for (int j=0;j<10;j++)
                        {
                                for (int i=0;i<1000;i++)
                                {
                                        DataRow row=dt.NewRow();
                                        row["id"]=Guid.NewGuid();
                                        row["parentid"]=j.ToString();
                                        dt.Rows.Add(row);
                                }
                        }
                        DateTime end=DateTime.Now;
                        Console.WriteLine(" "+dt.Rows.Count+" rows inserted :
"+(end-begin));
                        begin=DateTime.Now;
                        DataView dv=dt.DefaultView;
                        dv.RowFilter="parentid='0'";
                        ArrayList list=new ArrayList();
                        foreach (DataRowView row in dv)
                        {
                                list.Add(row.Row);

                        }
                        dv=null;
                        end=DateTime.Now;
                        Console.WriteLine("filter done!!! : "+(end-begin));
                        begin=DateTime.Now;
                        foreach(DataRow r in list)
                                dt.Rows.Remove(r);
                        end=DateTime.Now;
                        Console.WriteLine("line removed"+list.Count+"
"+(end-begin));
                        Console.ReadLine();

                }

                public static void Main(string[] args)
                {
                        DataRowViewTest();
                        return;
                }
}

This program insert 10000 rows in a datatable
Search 1000 rows (with parentid = 0)
Try to remove them (the previously searched rows)

On mono 1.9 svn linux : you get 
10000 rows inserted : 00:00:01.1328230
filter done!!! : 00:00:00.1232720
line removed1000 00:00:22.7847800  

-> Take a look at the last line : 22s to remove 1000 rows from a data table?
What happens!!!!

On MS.NET 1.1 on windows you get on the same machine :

10000 rows inserted : 00:00:00.1562470 (9x better)
filter done!!! : 00:00:00.0624988 (2x better)
line removed1000 00:00:00.0156247 (1518x better)

I think there's a problem with row removing code...

Thanks for fixing this!


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list