Description:
What ways are there of optimizing the XtraGrid's screen refresh speed?
What options and features are "expensive" in performance terms when enabled?
Answer:
The XtraGrid's painting performance depends mainly on the number of visible grid columns and rows. More rows and columns displayed within the grid view, mean more time is needed to paint a grid view. Various in-place editors, custom cell styles, and the AutoRowHeight feature also slow down performance.
Advanced data features, such as groups, summaries and sorted columns have only an insignificant impact on painting performance. However, they may cause performance hits when the underlying data is changed and the XtraGrid needs to refresh groups and recalculate summaries.
If the XtraGrid paints too slowly in your application, please try to reduce the number of displayed rows and columns: reduce the GridControl height and hide some columns.
If performance problems are observed when refreshing data, try to reduce the number of summaries and grouped/sorted grid columns. Usually, you can substitute filters for groups. Summaries can be created/removed dynamically.
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
What if we use the gridView1_CustomDrawCell() event?
This event actually runs on rows, not visible. When having 32000 rows in the grid; it can take more than a minute to refresh, although it is not necessary to paint them all. We need a new event to determine; if the row is actually visible, before calling the event. Something like; gridView1_CustomDrawVisibleCells() would be nice. This will reduce the initial wait; and only be fired; when the grids visible rows changes. I know; it will slow the single line scrolling; but the wait will probably not be annoying to the end-user - compared to the current solution.
The CustomDrawCell event is raised for visible rows and columns only. I have attached a project illustrating this. It is strange why this event is raised for all rows and columns in your case. Would you please create a separate ticket and provide a project reproducing the issue?
OK. You are right. It wasn't the issue. I was wrong. The problem comes; when changing the width of all columns after loading data into the DataSource; applying the column.BestFit(). It seems; all rows will be traversed; although only top 20 rows are visible. This can't be changed; since a best fit on other rows will change the width of the columns; while traversing the rows. Then we are back to resolve by reducing the number of rows to present to the end-user. Setting column width is better in performance than BestFit(). Thanks for your time.
Hi Holger,
Here is a quote from our documentation about the BestFit method:
Note that the number of processed data cells depends upon the GridView.BestFitMaxRowCount property value. If set to -1, all data cells are processed. If set to a positive integer, the property specifies the number of cells to be processed. Cells are processed starting from the top visible row.
So, you can just set the BestFitMaxRowCount property to specify the BestFit behavior.
I hope you will find this information useful.
Absolutely interesting. Well, now we are talking. I add extra 20 pixels for graphics in the beginning of certain columns; when in CustomDrawCell() event. column.BestFit() don't know about this extra space; thereby cutting the last 20 pixels of the end of text. If I could somehow tell the BestFit() method that I want it to prefix with 20 pixels; the BestFit() algorithm could use this info to correctly fit the cell width. The interface could be something as simple as column.BestFit(int WidthExtention = 0).
Posting multiple questions within a report makes it difficult to properly track and process such items.
In order to better serve you and track multiple questions in your inquiry, we have taken the liberty of separating the issues you addressed. For quick and efficient responses to your concerns, we kindly request that future inquiries address one issue at a time. Your time and cooperation are appreciated.
Please refer to this report for further correspondence on this item.