davidegironi / advanceddatagridview

A .NET WinForms DataGridView with advanced capabilities
392 stars 123 forks source link

SpeedUp "CheckTextFilter_TextChanged" #70

Closed 0lliS closed 3 years ago

0lliS commented 3 years ago

Hi,

I have more than 20.000 different entries in one Column. "CheckTextFilter_TextChanged" runs each time you press a key. The procedure is working very slowly because of the huge amount of entries.

I took a look at the source code and realized that you are using three loops. Might it be possible to replace them by a single linq-search that always uses the full list? This full list could be created once and saved temporarily when you open the search menu until the menu is closed. A copy of this temporary list would be used for each linq-search.

By always using the full list, the quality of the results would also be improved. The loop crosses entries out of the list. When you delete a letter, the list stays filtered and those entries, which fit again are already out of the list.

Please feel free to improve my suggestion.

Thanks for your great support.

0lliS

ADGV_SearchToSlow

0lliS commented 3 years ago

This might also fix the problem in #65

davidegironi commented 3 years ago

Hello, I think you are looking at old code version, the newer one "only" perform two loops (https://github.com/davidegironi/advanceddatagridview/blob/d0b3cc259dd7d288a89f65a1a11d7e05c202d220/AdvancedDataGridView/MenuStrip.cs#L1631)

Anyway, even the newer one could be optimized of course, but I don't have the time right now to do this. If I take a quick look I can say it will take a bit of effort cause there's recursive calls handling state of nodes involved (NodeCheckChange). If you find a way to optmize this please share it here.

The https://github.com/davidegironi/advanceddatagridview/issues/65 is a little different taks, anyway it's solved.