Blogs

XPO

eXpress Persistent Objects

September 2011 - Posts

  • XPO - 11.2 Sneak Peek – XPCollection performance improvements (once again!)

         

    Prerequisites

    As you probably know, when inserting or removing records from collections supporting IBindingList, it is necessary to load the entire collection (that means constructing its persistent objects and their related objects graphs) from the database. It is an understandable requirement (we need to fire the IBindingList.ListChanged event with correct indices), but it might drive to some XPO customers crazy. For example, if we inserted or removed an object from an associated details collection containing a lot of complex objects, it might become a performance problem.

    Though there has been an unofficial solution (based on the use of IList collections instead of collections of XPCollection type) available for many years, it was not final and had some drawbacks (the need to redesign persistent classes, inability to access Criteria and other features of the XPCollection, data binding limitations, etc.). Finally, improving the current state of affairs has also been one of the most popular requests our customers asked  us for in recent years.

    One-to-many associations are significantly faster in 11.2

    Our developers have managed to work around the limitation described above in version 11.2, and trust me, it is something you will notice immediately. Generally, XPCollection will perform significantly faster on inserting and deleting objects into and from a large associated 1-M details collection. Certainly, the exact speed improvement will depend on the collection size, the complexity of your objects graphs and other factors. Note that these changes do not affect M-M details collections at this time, because this is a more difficult case. We will research it the future.

    To test it in action, I used a modified version of the test application (you can download it here) from my previous blog. See my results below:

    11.1.7

    11.2.1

    image image
    image image

    As you see, it is ~100x faster on insert and ~10x faster on removal when the details collection was comprised of 10000 objects. These improvements will be more noticeable, the greater the size of the details collection.

    Do you like the XPO improvements? Please let us know your opinion!

    Happy XPOing!

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

         

    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:

    10.2.9

    10.2.9_thumb[4]

    11.1.7

    11.1.7

    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

More from DevExpress
Live Chat
Have a pre-sales question?
Need assistance with your evaluation?
We are here to help.
Chat is one of the many ways you can contact members of the DevExpress Team. We are available Monday-Friday between 8:30am and 5:00pm Pacific Time.
If you need additional product information, require pre-sales assistance, or want help with your order, write to us at info@devexpress.com or call us at
+1 (818) 844-3383.