Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Matt Cheale 8 posts 33 karma points
    Jan 31, 2017 @ 15:29
    Matt Cheale
    1

    Slow retrieval with many children

    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?

    Thanks.

  • Stephen 767 posts 2273 karma points c-trib
    Feb 03, 2017 @ 18:27
    Stephen
    0

    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

  • Nicholas Westby 2054 posts 7104 karma points c-trib
    Feb 03, 2017 @ 19:01
    Nicholas Westby
    0

    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.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies