SourceGrid Optimization story

April 6, 2010


Today I was playing around with SourceGrid. I noticed that for some reason simply resizing the window would cause the window to flicker, even though the data store was not beeing accessed.

The problem was in the fact that GetTotalHiddenRows method was a linear implementation, simply looping through all the rows. Even though the dataset was not that big (60k rows), that caused a lot of troubles.

The problem was fixed by implementing a simple ref-counting. That is, the moment the row became hidden, it produced an event. That event was caught by hidden rows calculator, which exposed a simple property TotalHiddenRows.

The result can be seen in this dotTrace image:

We can see a reduction in calls to PingGridRows.GetCount by 1 million, and GridVirtual.GetFixedRows by 2 million.

That solved this issue

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: