Performance of retrieving reference sets

I was wondering which approach was faster if i want to retrieve all orderlines of an order, which can be found throug a N - 0 association starting at order. (in pseudo code): List<IMendixObject> orders = Core.retrieveXPath("//OrderLine[Orders.Orderlines = " +orderObject.getGUID() + "]") or List<IMendixIdentifier> ids = OrderObject.getMember("Orders.Orderlines").getValue(); List<IMendixObject> orders = Core.retrieveIds(ids); So my questions are Which code is faster in general (does it make a difference for big or small refencesets?) Which code is faster if i execute the code twice? I can imagine executing the second block does not query the database at all the second time?
1 answers

Ok, i understood that Core.retrieveIds does not use caching, so in general the first solution will be at least as fast as the second one. I guess in most cases it is even faster, since it saves at least one database query.

The OrderObject.getMember("Orders.Orderlines").getValue() approach however seems to be faster than the query approach, if you only need the IMendixIdentifiers, and not the objects themselves (for example to amend a referenceset).