http://bugzilla.novell.com/show_bug.cgi?id=569636

http://bugzilla.novell.com/show_bug.cgi?id=569636#c0


           Summary: Bad performance looping on DataSets
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.4.x
          Platform: x86-64
        OS/Version: RHEL 5
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: misc
        AssignedTo: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
          Found By: ---
           Blocker: ---


Created an attachment (id=335854)
 --> (http://bugzilla.novell.com/attachment.cgi?id=335854)
Profiler output

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7)
Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729)

Looping inside big dataset whit inner selections is really slow compared to
MS.Net performances.

With the code provided below with MS.Net on a standard developer machine
and Mono on a bi-processor testing machine (with 2GB of ram):

1000 rows
MS.Net: 130ms
Mono 2.4.3:  1.2s
Mono 2.0.1:  3.5s

10.000 rows
MS.Net: less than a second
Mono 2.4.3: 114s
Mono 2.0.1: 361s

The problem is in the .Select method, removing those lines the elaboration
is quicker in Mono. Testing machines are not with the same resources but the
difference is too much to think to an hardware difference.
Here is the code...

            DataSet ds1 = new DataSet();
            ds1.Tables.Add();
            ds1.Tables[0].Columns.Add("COL1", typeof(string));
           ds1.Tables[0].Columns.Add("COL2", typeof(int));
           ds1.Tables[0].Columns.Add("COL3", typeof(bool));
            for (int i = 0; i < 10000; i++) {
                ds1.Tables[0].Rows.Add(new object[] { "test", i, true });
            }
             DataSet ds2 = new DataSet();
            ds2.Tables.Add();
            ds2.Tables[0].Columns.Add("COL1", typeof(string));
            ds2.Tables[0].Columns.Add("COL2", typeof(int));
            ds2.Tables[0].Columns.Add("COL3", typeof(bool));
             for (int i = 0; i < 10000; i++) {
                 ds2.Tables[0].Rows.Add(new object[] { "test", i, true });
            }
            DataSet ds3 = new DataSet();
            ds3.Tables.Add();
             ds3.Tables[0].Columns.Add("COL1", typeof(string));
            ds3.Tables[0].Columns.Add("COL2", typeof(int));
            ds3.Tables[0].Columns.Add("COL3", typeof(bool));
            for (int i = 0; i < 10000; i++) {
                ds3.Tables[0].Rows.Add(new object[] { "test", i, true });
            }
             int idx=0;
            foreach (DataRow dr in ds1.Tables[0].Rows) {
                DataRow[] dr2 = ds2.Tables[0].Select("COL2=" + idx);
                DataRow[] dr3 = ds3.Tables[0].Select("COL2=" + idx);

                idx++;
            }

I attach also a summarized profiler output generated by Jonathan Chambers. This
is the above sample for 1000 rows instead of 10000, and with
--profiler=default:time.

Reproducible: Always

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to