Performancekiller Image Cell

Mar 16, 2010 at 3:05 PM
Edited Mar 16, 2010 at 3:08 PM


Had big performance issues with sourcegrid and found (probably) bad code. There were some Windows-Handles Exceptions and hanging apps if we build a grid with lots of cells, some with Image cells.

Seems the code is not ok here in the class Image : Cell of Namespace SourceGrid.Cells. Every single cell instance its own editor, a ImagePicker. In a quick and dirty hack, I changed it to one static ImagePicker for every cell and there are no more performance and Windows-Handles issues...

Can anyone review the very small code and give some hints how to fix it proper?


Mar 17, 2010 at 9:17 AM

Could you help us by creating a sample which would show this performance problem?

Mar 17, 2010 at 9:45 AM
Edited Mar 17, 2010 at 9:46 AM


Just use Sample 04 and replace lines from 240 to 252 with one single line: 

grid[r, c]  = new SourceGrid.Cells.Image(Properties.Resources.CalcioSmall);


See what happen with the default dimension 200 x 15 cells. On my machine, nothing happen. The App hangs and I have to shut down it.

To show what the problem with the editor might be, I use this to show (but not edit) the image:

grid[r, c] = new SourceGrid.Cells.Cell(string.Empty);
grid[r, c].Image = Properties.Resources.CalcioSmall;

A deeper view into Image cell on line 50 tells me, that every Image cell gets a comletely new ImagePicker. This seems to be a overhead. You tell us in the documentation to use a single instance of an editor.


Mar 17, 2010 at 12:56 PM
Hi Kaepten, You are very true - a single editor should be preferably used for every cell. I just committed fixes to repository as you suggested. The problem seems gone know