In my Gantt-View, data binding is taking ages.
Initial binding takes more than 30 seconds for a few thousand records, updating is slightly faster at around 8 seconds.
Even more puzzling, after update data has been merged (DataSet merge), I try to restore the last active task. When I allocate the task to the GanttView's ActiveTask property, again it takes longer than 30 seconds.
// re-select formerly selected task if (_lastActiveTask != null) { foundTask = FindTask(_calendarInfo.Tasks, _lastActiveTask); if (foundTask != null) ultraGanttView.ActiveTask = foundTask; <--- this takes ages }
When I remove this allocation, the system will hang at the next allocation to the gantt chart:
// re-set scrollbar position if (_firstVisibleTask != null) { foundTask = FindTask(_calendarInfo.Tasks, _firstVisibleTask); if (foundTask != null) ultraGanttView.EnsureTaskInView(foundTask, true); <--- this takes ages, when code above is removed }
To sum up, always the first allocation plus binding and updating is taking far too long. I assume I missed out on some weird setting and appreciate any help :)
Before doing all that stuff, of course I do this:
ultraGanttView.BeginUpdate(); ultraGanttView.SuspendLayout();
OK, I will continue to search for a cause from our end while you work on the sample.
I did
a) fill custom columns from a static data sourceb) fill custom columns from a detached data source
Both of which did not improve things.
My application data is stored into a DataSet in the presenter after retrieving it from the database, before being bound to the view.
I also recognised that the ultraGanttView_InitializeTaskGridRow event ist called twice for each row each time, which would already make up for 50% of the wasted time.
Also, merging the current data with updated data from the database (DataTable.Merge()) is too slow, i found that this is caused by the destination table having modifications. When I call AcceptChanges() on that table upfront, the custom columns are not created and ultraGanttView_InitializeTaskGridRow always fails with NullReferenceExceptions.
I will provide a sample asap, but have other tasks, too, atm :/
Your last point is valid. It would be worthwhile to try saving a portion of your application data (or data with the same structure) to a static data source, and then binding your ganttview to this data source and seeing if the binding factor decreases the performance of the control.
In your origional application, is the data loaded into an object in memory and then bound to the control? If you are using the control to access the data directly from your database, this data retrieval process could potentially be a key factor affecting the performance.
Regarding the SetCustomProperty(), you may try providing a static value. This would test if the performance issue lies in the SetCustomProperty() itself, or somewhere in the logic providing a return for SetCustomProperty().
At any rate, if you could attach your sample so far, I would be happy to take a look at it and perform testing on its performance. If you could make the sample data resemble the data structure you are using in your application, that may provide me more insight regarding the underlying issue.
Still can not reproduce the issue outside the project.
Nonetheless, I found that the InitializeTaskGridRow-event takes most of the time. I have 6 custom columns, which are filled with values from the datasource. Value assignment (e.Task.SetCustomProperty()) is utterly slow, between 4 and 16ms per row.
Might it be a problem that these values are bound values? In the sample, custom values are unbound.
This indicates a couple possible factors which may be causing hang up for your application:
If the former is true, it is possible that the control has a weakness servign that particular data, and the reproducing sample would be greatly appreciated so that we could investigate why the control is weak for it. If the latter is true, the issue may exist somewhere outside the GantView.
Please let me know if you uncover any other pertinent information.