We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Fast updating performance

I have an unusual use case for the grid that I don''t see used very often within these forums. We are using it to measure data up to speeds of 10Hz, and performance is of utmost importance. We receive an array of float values to display (newValues[] in this case) and display them in a column, with the other columns simply containing other static data. The current implementation is shown below. for(int row = 0; row < gridControl.Model.RowCount; row++) { gridControl.Model[row + 1, 2].CellValue = newValues[row]; } gridControl.InvalidateRange(GridRangeInfo.Cols(2,2)); gridControl.Update(); Is there a different implementation that you suggest that might be more performant?

4 Replies

AD Administrator Syncfusion Team September 28, 2005 08:29 PM UTC

Hi Mitch, yes - definitely. Setting the CellValue and calling Invalidate/Update will not give you the speed you need. Check out the Performance/TraderGridTest example. - It uses the DrawClippedGrid method and caches the graphics context across drawing operations. - It uses GDI for faster rendering of the text - It turns off the dotted lines and instead draws solid grey lines. - Optionally you can also disable the PrepareViewStyleInfo event. With those changes in place the grid should give you the speed you need. Instead of gridControl.Model[row + 1, 2].CellValue = newValues[row]; which will itsself cause an Invalidate / Update in order to refresh the cell you should instead modify the gridControl.Data object directly by calling SetCellInfo, e.g. Graphics cachedGraphis; // make this a member of class GridStyleInfo style = new GridStyleInfo(); for(int row = 0; row < gridControl.Model.RowCount; row++) { gridControl.SetCellInfo(row + 1, 2, style, StyleModifyType.Override, true, false); } if (cachedGraphics == null) cachedGraphics = gridControl.CreateGridGraphics(); gridControl.DrawClippedGrid(cachedGraphics, gridControl.RangeInfoToRectangle(GridRangeInfo.Cols(2,2)); Stefan >I have an unusual use case for the grid that I don''t see used very often within these forums. We are using it to measure data up to speeds of 10Hz, and performance is of utmost importance. We receive an array of float values to display (newValues[] in this case) and display them in a column, with the other columns simply containing other static data. The current implementation is shown below. > >for(int row = 0; row < gridControl.Model.RowCount; row++) > { > gridControl.Model[row + 1, 2].CellValue = newValues[row]; > } > gridControl.InvalidateRange(GridRangeInfo.Cols(2,2)); > gridControl.Update(); > >Is there a different implementation that you suggest that might be more performant?


MT Mitch Todd September 30, 2005 01:05 PM UTC

Hey Stefan, Exactly what I was looking for (though I was not able to put it into action)!! We are still behind the times with our version of Syncfusion. Can you tell me in what version DrawClippedGrid is available?? Thanks, Mitch


AD Administrator Syncfusion Team October 1, 2005 03:09 AM UTC

It is in 3.2.1.0 and later.


MT Mitch Todd November 9, 2005 03:18 PM UTC

All right, so I finally implemented the new drawing solution into my quickly updating grid, and the results were not quite what I expected. We have a requirement to update a maximum of 320 values on the screen at 10 Hz with a reasonable CPU load. Updating 240 values with the following code yielded about 75% or so of the CPU. Am I still missing the performance possibilites of the Syncfusion grid?? Thanks in advance, Mitch private void OnNewValues(float[] newValues) { try { this.gridControl.PopulateValues(GridRangeInfo.Cells(1,_valueColumn,this.gridControl.RowCount,_valueColumn), newValues); gridBmp = new Bitmap(this.gridControl.Width, this.gridControl.Height); gridGraphics = Graphics.FromImage(gridBmp); if(g == null) { g = this.gridControl.CreateGridGraphics(); } this.gridControl.DrawClippedGrid(gridGraphics, this.gridControl.RangeInfoToRectangle(GridRangeInfo.Cols(_valueColumn,_valueColumn))); g.DrawImage(gridBmp, 0, 0); } catch(Exception ex) { Logger.LogException(ex); } } >It is in 3.2.1.0 and later.

Loader.
Live Chat Icon For mobile
Up arrow icon