Computing Column Width in big virtual tables

I’m currently developing an application, which uses grids with big number of rows (the order could be hundred of thousands rows and in some cases millions of rows).

I would like to offer my users reasonable column widths for the grids.

However, using grid.AutoSizeColumns() does not look feasible, as running it on tables with big number of rows takes more then one minute, which does not look user-friendly.

Is there an option of estimate column sizes on the base of the subsample of data (for example, using one thousand rows), which would allow perform column size estimation reasonably well?

There’s no prepackaged solution, you’d have to roll your own, using either wx.ClientDC.GetTextExtent or a rougher estimate using character counts.

If you’re looking for a heuristic, I suggest the size at the 90% percentile of the sample plus 10 percent.