gitextensions/gitextensions — pull request #2295 by vcpp (2014-03-23 20:23:22+00:00)
Title: #2294 fixed: Commit dialog hangs for hours on selecting or deselecting many files

Just compare profiler reports.

Handling each index change:
```
100,00% b__38 • 3 063 859* ms • 1 call • GitUI.GitUICommands+<>c__DisplayClass39.b__38
100,00% ShowDialog • 3 063 859 ms • 1 call • System.Windows.Forms.Form.ShowDialog(IWin32Window)
73,97% WndProc • 2 266 428 ms • 659 calls • GitUI.UserControls.ExListView.WndProc(Message&)
73,97% WndProc • 2 266 427 ms • 659 calls • System.Windows.Forms.ListView.WndProc(Message&)
73,95% WndProc • 2 265 721 ms • 38 042 calls • GitUI.UserControls.ExListView.WndProc(Message&)
73,95% WndProc • 2 265 575 ms • 38 041 calls • System.Windows.Forms.ListView.WndProc(Message&)
73,93% FileStatusListView_SelectedIndexChanged • 2 265 042 ms • 12 649 calls • GitUI.FileStatusList.FileStatusListView_SelectedIndexChanged(Object, EventArgs)
73,93% UnstagedSelectionChanged • 2 265 036 ms • 12 649 calls • GitUI.CommandsDialogs.FormCommit.UnstagedSelectionChanged(Object, EventArgs)
>31,24% ToList • 957 107 ms • 12 649 calls • System.Linq.Enumerable.ToList(IEnumerable[TSource])
>29,74% Any • 911 170 ms • 12 649 calls • System.Linq.Enumerable.Any(IEnumerable[TSource])
>12,92% ShowChanges • 395 878 ms • 12 649 calls • GitUI.CommandsDialogs.FormCommit.ShowChanges(GitItemStatus, Boolean)
4,97% b__f • 152 329 ms • 12 652 calls • GitCommands.AsyncLoader+<>c__DisplayClass11`1.b__f(Task[T])
4,97% b__15 • 152 320 ms • 12 649 calls • GitUI.Editor.FileViewer+<>c__DisplayClass19.b__15(String)
4,97% ViewText • 152 318 ms • 12 649 calls • GitUI.Editor.FileViewer.ViewText(String, String)
>4,65% SetText • 142 323 ms • 12 649 calls • GitUI.Editor.FileViewerWindows.SetText(String)
>0,32% ResetForText • 9 657 ms • 12 649 calls • GitUI.Editor.FileViewer.ResetForText(String)
```

Ignoring index changes which are followed by next index change within milliseconds:
```
100,00% StartCommitDialog • 7 904* ms • 1 call • GitUI.GitUICommands.StartCommitDialog(IWin32Window)
100,00% StartCommitDialog • 7 904* ms • 1 call • GitUI.GitUICommands.StartCommitDialog(IWin32Window, Boolean)
100,00% DoActionOnRepo • 7 904* ms • 1 call • GitUI.GitUICommands.DoActionOnRepo(IWin32Window, Boolean, Boolean, GitUIEventHandler, GitUIPostActionEventHandler, Func[Boolean])
100,00% b__38 • 7 904* ms • 1 call • GitUI.GitUICommands+<>c__DisplayClass39.b__38
100,00% ShowDialog • 7 904 ms • 1 call • System.Windows.Forms.Form.ShowDialog(IWin32Window)
>10,96% WndProc • 866 ms • 41 calls • GitUI.UserControls.ExListView.WndProc(Message&)
4,67% OnNext • 369 ms • 1 call • System.Reactive.AnonymousSafeObserver`1.OnNext(T)
4,67% ctor>b__2 • 369 ms • 1 call • GitUI.FileStatusList.ctor>b__2(EventPattern[EventArgs])
4,67% FileStatusListView_SelectedIndexChanged • 369 ms • 1 call • GitUI.FileStatusList.FileStatusListView_SelectedIndexChanged
4,67% UnstagedSelectionChanged • 369 ms • 1 call • GitUI.CommandsDialogs.FormCommit.UnstagedSelectionChanged(Object, EventArgs)
>2,27% Any • 180 ms • 1 call • System.Linq.Enumerable.Any(IEnumerable[TSource])
>2,00% ToList • 158 ms • 1 call • System.Linq.Enumerable.ToList(IEnumerable[TSource])
>0,39% ShowChanges • 31 ms • 1 call • GitUI.CommandsDialogs.FormCommit.ShowChanges(GitItemStatus, Boolean)
>0,00% ClearDiffViewIfNoFilesLeft • 0 ms • 1 call • GitUI.CommandsDialogs.FormCommit.ClearDiffViewIfNoFilesLeft
```

Now selecting or deselecting unstaged files takes less than second regardless of files count, there is actually single refresh.