Performance boost on removing data from a large XPCollection (available in 11.1.7)

12 September 2011

I am happy to announce that XPO developers have tweaked XPCollection in version 11.1.7, and trust me, it is something you will notice immediately. This improvement was accomplished while working on a customer's issue and that again proves how customer feedback is invaluable to us.

Generally, XPCollection will perform several times faster on removing objects from large associated 1-M or M-M details collections. Certainly, the exact speed improvement will depend on the collection size, the complexity of your object graphs and other factors. Also, you will be interested to know that we achieved this by optimizing the removal algorithm that sets a reference to a master object to null (you can improve your familiarity with associations in XPO by reading this KB Article).

To demonstrate these improvements in action, I built a small console application with a couple of persistent classes, with a 1-M relationship between them. My test applications first created several master objects (5 and 10) with several thousand details (5000 and 10000) in each, committed them all to the Microsoft SQL Server database and then ran another loop to delete each master and its details from the database. Time was measured for the remove operation performed for each master object. Test applications were built in the Release configuration (+ Any CPU) against .NET 4.0 and the 10.2.9 and 11.1.7 versions of XPO. You can download test applications as well as screenshots showing the results using the links below:

During tests, most noticeable (~3-4 times faster) improvements occurred when the details collection was comprised of 10000 objects:





It was ~2x faster on 5000 details. I expect improvements will be more noticeable (maybe dozen and hundreds times faster) the greater the size of the details collection.

The good news is that more performance improvements are coming in v2011 vol2! I am preparing another blog post about this, and hope to publish it this week. Stay tuned, and please let us know how much better your real XPO applications perform in 11.1.7. Thank you in advance!

Happy XPOing!Winking smile

5 comment(s)

Awesome.. so these time improvements are inherent in simply using XPO and not dependent on remembering certain tricks?

12 September, 2011
Dennis (DevExpress Support)

@Drew: Yes, you are correct. It should work without any additional steps.

12 September, 2011
Chris Royle

Will the performance improvement be the same in XAF ? Is the performance improvement similar to that which one can achieve by removing the AggregatedAttribute ?

12 September, 2011
Dennis (DevExpress Support)


Thank you for your interest!

>>Will the performance improvement be the same in XAF ?

Sure. XAF uses XPO and it automatically has its features.

>>Is the performance improvement similar to that which one can achieve by removing the AggregatedAttribute ?

No, it is a bit different. Deletion performance is usually worse for an object having aggregates, because it is necessary to remove them as well. For instance, removing an aggregated details collection means enumerating through it, to load its objects and reset their references to the master object.

The described improvement is true for non-aggregated details collections only, and as I mentioned in the blog, it was achieved by improving the deletion algorithm.

12 September, 2011

Prerequisites As you probably know, when inserting or removing records from collections supporting IBindingList

13 September, 2011

Please login or register to post comments.