Hi,
We are using UltraWinGrid to display frequently updated data. The datasource is set to BindingSource which in turn takes a dataset. When there are a lot of updates coming in at the same time, the CPU usage spikes. It appears a GUI painting issue because when we shrink the application window to make updating region invisible, CPU usage comes back to normal. Is there a way to optimize grid painting performance? Would virtual mode help?
Thanks.
Simon
Hi Matt,
Thanks for the quick reply. We are listening to a datasource for update. So it's not easy to batch the update unless we add throttling into our datasource. I am just wondering whether there is a way to suppress grid's repaint so we can just make force repaint periodically. I set BindingSource.RaiseListChangedEvents = false but grid is still updating/repainting itself.
Simon,
I meant that you wrap the updates in a BeginUpdate/EndUpdate, unless you are just getting each update one-at-a-time and you have no way of combining them into batch updates. I can't really say when the best places to do this is since I don't know how you're updating the grid, but it'd be something like:
grid.BeginUpdate();
dataSource.Rows[0].Cells[3].Value = "Some New Value";
dataSource.Rows[1].Cells[2].Value = "Happy Happy, Joy Joy";
grid.EndUpdate();
-Matt
Thanks for your reply. We are still on 7.1. How can we wrap painting in BeginUpdate/EndUpdate block? We are using BindingSource so the grid update itself whenever datasource changes. I suppose you mean there is a way that I can suppress grid from repaint itself, then I can batch the updates. Can you give me more details on that?
What version of the grid are you using? I know that a lot of performance improvements were made in the 7.3 release. From what it sounds like, it definitely seems like a painting issue, since the size of the grid directly affects performance. One thought would be that if you know you're getting a large batch of updates at once, you could try wrapping them in a BeginUpdate/EndUpdate block on the grid so that it only needs to paint once.