var t = DateTime.Now;
const int galleryRootNodeId = 1119;
var root = new DynamicNode(galleryRootNodeId);
var children = root.DescendantsOrSelf("Image").Items.OrderByDescending(n=>n.Id).take(10);
var diff = DateTime.Now.Subtract(t).TotalMilliseconds;
That get the newest 10 images in a folder in the media section.
The problem is that it takes ALOT of time to traverse all the images and get the ten newest. There are around 2500 images and the depth of the folders are no more than 4 at most, which to me sounds pretty ok.
DescendantsOrSelf is slow in media section
I have the following snip:
That get the newest 10 images in a folder in the media section.
The problem is that it takes ALOT of time to traverse all the images and get the ten newest. There are around 2500 images and the depth of the folders are no more than 4 at most, which to me sounds pretty ok.
Any sugestions ?
Right.
I came up wih a solution my self and getting speed gain from 200180 milliseconds to 187 ms
var t = DateTime.Now;
const int galleryRootNodeId = 1119;
var root = new Media(galleryRootNodeId);
var children = root.GetDescendants();
var list = children.Cast().ToList();
var diff = DateTime.Now.Subtract(t).TotalMilliseconds;
is working on a reply...