[Mono-bugs] [Bug 386715] New: Performance Problem when filling a TreeView

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon May 5 09:55:23 EDT 2008


           Summary: Performance Problem when filling a TreeView
           Product: Mono: Class Libraries
           Version: 1.9.0
          Platform: x86-64
        OS/Version: SLES 10
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: carsten.sponsel at astrum-it.de
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

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

The Mono (1.9.3) TreeView shows a dramatic performance compared with the .NET's
TreeView when adding new nodes. The more nodes my program adds, the worse the
performance is. When I'm inspecting the profiler output I'm having the
impression that my program is mainly occupied with sending messages and
updating controls.

That is my program:

// TestTreeViewPerf.cs created with MonoDevelop

using System;
using System.Windows.Forms;

namespace TestTreeViewPerf
    public class TestTreeViewPerf : Form
        public TestTreeViewPerf() : base ()
            TableLayoutPanel lp = new TableLayoutPanel ();
            lp.RowCount = 2;
            lp.ColumnCount = 1;
            lp.RowStyles.Add (new RowStyle (SizeType.Percent, 100));
            lp.RowStyles.Add (new RowStyle (SizeType.AutoSize));

            Button FillTree = new Button ();
            FillTree.Text = "Fill Tree";
            FillTree.Click += new EventHandler (FillTree_Click);

            lp.Controls.Add (m_Tree);
            m_Tree.Dock = DockStyle.Fill;
            lp.Controls.Add (FillTree);

            Controls.Add (lp);
            lp.Dock = DockStyle.Fill;

        private void FillTree_Click (object sender, EventArgs args)
            for (int i = 0; i < 2000; i++)
                TreeNode tn = new TreeNode (i.ToString ());
                tn.Name = i.ToString ();
                m_Tree.Nodes.Add (tn);

                for (int j = 0; j < 5; j++)
                    TreeNode subtn = new TreeNode (j.ToString ());
                    subtn.Name = j.ToString ();
                    tn.Nodes.Add (subtn);

        TreeView m_Tree = new TreeView ();

        public static void Main (string [] args)
            Application.EnableVisualStyles ();
            Application.SetCompatibleTextRenderingDefault (false);
            Application.Run (new TestTreeViewPerf ());

I've added the profiler output file as attachment.

Configure bugmail: https://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.

More information about the mono-bugs mailing list