Did a quick and dirty Razor file with the following code:
@{
var t1 = DateTime.UtcNow.Ticks;
var blog = Umbraco.TypedContent(1155);
var t2 = DateTime.UtcNow.Ticks;
var url = blog.Url;
var t3 = DateTime.UtcNow.Ticks;
var abs = blog.UrlAbsolute();
var t4 = DateTime.UtcNow.Ticks;
}
Step 1: @((t2 - t1) / TimeSpan.TicksPerMillisecond)<br />
Step 2: @((t3 - t2) / TimeSpan.TicksPerMillisecond)<br />
Step 3: @((t4 - t3) / TimeSpan.TicksPerMillisecond)<br />
No of children: @blog.Children.Count()
The results I got were:
Step 1: 46
Step 2: 46
Step 3: 45
No of children: 71
Step 1: 18
Step 2: 19
Step 3: 18
No of children: 33
Step 1: 2
Step 2: 0
Step 3: 2
No of children: 4
The parent nodes are things like blog and news collation pages that don't use any date based structure. Is this normal? Should I look to move the actual posts out from under this node so these queries are would not be affected?
At first I could not believe it but... confirmed. There's a reason for it, which has to do with the structure of the Xml cache: every node in there has a collection of child nodes, which can be either property data nodes or child content nodes. When we initialize a node, we go over all children to gather the property data values... which means we also go over child content nodes => the number of children has an impact.
Is it that slow only on first access, or are subsequent calls to Umbraco.TypedContent / .Url / .UrlAbsolute() also that slow (e.g., in a later HTTP request)?
Slow retrieval with many children
Did a quick and dirty Razor file with the following code:
The results I got were:
The parent nodes are things like blog and news collation pages that don't use any date based structure. Is this normal? Should I look to move the actual posts out from under this node so these queries are would not be affected?
Thanks.
At first I could not believe it but... confirmed. There's a reason for it, which has to do with the structure of the Xml cache: every node in there has a collection of child nodes, which can be either property data nodes or child content nodes. When we initialize a node, we go over all children to gather the property data values... which means we also go over child content nodes => the number of children has an impact.
There's a way to fix this... moving the discussion over to the issue tracker at http://issues.umbraco.org/issue/U4-9487
Is it that slow only on first access, or are subsequent calls to
Umbraco.TypedContent
/.Url
/.UrlAbsolute()
also that slow (e.g., in a later HTTP request)?If so, that is embarrassingly slow.
is working on a reply...