StrataFrame Forum

BusinessBindingSource.vb > ClearBusinessObjectList causing slow form close

http://forum.strataframe.net/Topic27495.aspx

By Peter Jones - 6/20/2010

Hi,



We have just added a (DevExpress) Pivot Grid control to an app and a user reported very slow form closing (2+ minutes) when he had a fair amount of data in the Pivot Grid (50,000 rows).



On closer investigation we see this is also the case in a normal Devexpress Grid. We hadn't noticed this before because our users would rarely have more than 2 or 3,000 rows in a grid - generally just a few hundred.



In tracking down the issue we see that it's in BusinessBindingSource > ClearBusinessObjectList. Please see the attached to screen shots:



SF_Dispose_01 - here the code is disposing of a BO (for a Pivot Grid) with 2826 rows in the grid.

SF_Dispose_02 - here the code is disposing of a BO (for normal Grid) with 23664 rows in the grid.



The problem is that line 244 is executed for every row in the BO rather than once for the BO.



We are using SF 1.7.0.7 in a VS2010 development environment.



This is proving to be a real nuisance for our user so, if possible, an early fix would be appreciated - even if it mean having to change our copy of the source code ourselves until a more formal fix is provided in a new release.


By Ivan George Borges - 6/21/2010

Hi Peter.

I have a feeling your solution wouldn't work, as the BBS IBindingList interface expects a unique instance of an object for each row instance, that is why you have seem the BO for each instance being disposed.

By Peter Jones - 6/21/2010

Hi Ivan,



I wan't proposing a solution - I was just bringing what I thought to a bug to your attention.



Are you saying it is 'by design' and we have to live with it?



Cheers, Peter
By Peter Jones - 6/21/2010

Hi Ivan,



We have a solution to our problem - so no urgency for any changes in the SF area. Rather than use a BO to populate the Pivot Grid we now use the BO's data table. The following code has been added just after the refresh of the BO using the current data selection criteria (dtForPivotGrid is a data table).



dtForPivotGrid = Me.BoHPCForPivot1.CurrentDataTable



Me.PivotGridControl1.DataSource = dtForPivotGrid



Me.BoHPCForPivot1.Clear()



This change has had an enormous impact. The form close is now instant but the time it takes to refresh the Pivot Grid has also been dramatically reduced. When the Pivot Grid used the BO refreshing it with (say) 200,000 records took about 4 minutes. Now the BO's data table is used (rather than the BO object itself) the Pivot Grid refresh just takes around 15 seconds.



Cheers, Peter
By Ivan George Borges - 6/22/2010

Glad to hear that Peter.

Sorry for the misunderstanding. I got the idea you were suggesting that the .Dispose should be moved outside the loop. Wink