C# Assigning a value to DataRow["haswhatnots"] = hasWhatnots is awful slow. hasWhatnots is a boolean value.
I have profiled this line and with 560000 hits the execution time is 82 seconds. Of course the profiler has some effect on the performance, but still the performance of this is grazy slow!
Any hints on the issue. The DataRow is part of a DataTable which is bound to BindingSource that is bound to DataGridView.Datasource.
You could try this
and see if it makes a difference.
(edit: only just saw that you are data-binding) The first thing to try is disabling data-binding; perhaps set the source to null and re-bind afterwards.
BindingSource
hasSuspendBinding()
,ResumeBinding()
andResetBindings()
for this.If the real problem is just lookup, you could take a snap of the
DataColumn
, and use:I seem to recall that this is the fastest route (the string overload locates the
DataColumn
from the list).Alternatively - use a
class
model instead ofDataTable
;-pVery late, but still had the same issue
There were extreme lags, occuring on (in my scale) large grids (60 cols, 10k+ rows), and this cutted the cpu time to less then one percent to what it was before.