diff options
author | Jim Westfall <jwestfall@surrealistic.net> | 2014-11-09 03:37:33 +0300 |
---|---|---|
committer | Jim Westfall <jwestfall@surrealistic.net> | 2014-11-09 03:37:33 +0300 |
commit | 7d1b878fbf13462a282860c6d1dd493a48d7b1eb (patch) | |
tree | f9935606c592367761ef6d749bc9286adbe7d423 /mcs/class/Managed.Windows.Forms/System.Windows.Forms | |
parent | 690a646c5e48f78313d16587a02a2380bf9e6c4d (diff) |
[MWF] DataGridViewRowCollection Clear() speed up
When issuing a Clear() to remove all rows, a ReIndex() was being called for
each row that was being removed. This is extremely inefficient, instead
do a single ReIndex() after all rows have been removed.
Before doing a Clear() of 30k rows was taking 5.8 seconds. With this patch
it now takes 670ms.
Diffstat (limited to 'mcs/class/Managed.Windows.Forms/System.Windows.Forms')
-rw-r--r-- | mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCollection.cs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCollection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCollection.cs index 8261f1f8756..9badc1dc7ab 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCollection.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCollection.cs @@ -268,9 +268,9 @@ namespace System.Windows.Forms row.SetDataGridView (null); list.Remove (row); - ReIndex (); } + ReIndex (); DataGridView.OnRowsPostRemovedInternal (new DataGridViewRowsRemovedEventArgs (0, total)); OnCollectionChanged (new CollectionChangeEventArgs (CollectionChangeAction.Refresh, null)); } |