7

I seem to remember that regarding performance optimization, the XML versions of the GetList and GetSystemWideList methods are preferred over the object versions. However I can't find any documentation or blog posts to back this up.

Can anyone confirm or debunk this statement?

5

Your memories of XML list methods performing better than the ones returning objects stem back from the early days of Tridion.

In the original (COM-based) TOM API, the XML list methods were wired up directly to the Data Access Layer and the methods which returned objects were implemented in a very primitive fashion: they internally invoked the XML list methods and then created TOM objects with only ID and Title properties pre-loaded; if you accessed any other object property, it would Just-In-Time load the entire object state.

So, typically, you would (maybe unknowingly) trigger an XML list plus individual reads for each item in the list. If the XML list contained all the data you needed, directly using it would be much faster.

Furthermore, the remote APIs (Business Connector and XML Responder) didn’t expose anything but the XML list.

The situation changed in the Tridion 2011 Release (aka “R6”), with the introduction of the TOM.NET and Core Service APIs. Internally, the wiring was done the other way around:

  • The Data Access Layer exposes list methods returning (Data) Objects.
  • The XML list methods internally use those Data Object lists and then serialize those Data Objects to R5 list XML (compatible with the XML lists from earlier releases).
  • The Core Service list methods returning objects directly expose the Data Objects. Since this is a remote API, the Data Objects will be serialized too in this case. This happens using the WCF Data Contract Serializer which produces so-called R6 XML (per definition; R6 XML is whatever the WCF Data Contact Serializer outputs when it serializes CM Data Objects).
  • The TOM.NET list methods which return object also internally use the Data Objects and wrap those in TOM.NET objects, which are pre-loaded with all the data available in the Data Objects. So, only if you access a property which is not available in the list data will a full load be triggered.

The difference between R5 list XML and R6 list XML is that the former is a bit more compact: R5 XML lists use XML attributes to contain the item properties, whereas R6 XML list use nested XML elements (again, this is just how the WCF Data Contract Serializer serializes the CM Data Objects).

  • Thank you for the elaborate explanation Rick! – Jeroen Suurd Mar 21 at 16:39
5

From my recent conversation with Rick (in the comments) here: https://tridion.stackexchange.com/a/19872/71

It appears that GetListXML() may not actually be more efficient than GetList() as the former calls the latter (internally) anyway.

It seems that the efficiency depends on what you plan to do with the results afterwards and what load flags are specified.

For example, if your code uses GetListXML() and then makes a separate call to fetch every item listed anyway, then you might be better off just using GetList() from the outset.

So it sounds like there’s no hard and fast rule and it depends on what you’re trying to do with the results, I’m afraid.

However, I’ve recently done this and only wanted local items. There’s no way to specify that in the GetList() call, so it was far more efficient to useGetListXML() and use the fromPub attribute to determine what was shared, local or localised.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.