Copied to clipboard

Flag this post as spam?

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


  • Harry Spyrou 212 posts 604 karma points
    May 31, 2018 @ 17:28
    Harry Spyrou
    0

    Is traversing umbraco slow?

    Hello everyone.

    I have a very generic question which is more of something I've been wondering. It's not of importance. So, I'm used to doing something like this:

    blabla.Parent()
    

    or

    blabla.first()
    

    or

    blabla.Ancestor('blibliblulu')
     blabla.Children
    
    blabla.Descendant('iWasOnceACowboy')
    

    The question is, is that way of traversing up and down the tree killing performance?

    If so, is there a better way of searching for nodes?

    Thanks in advance for any replies.

  • Alex Skrypnyk 6148 posts 24097 karma points MVP 8x admin c-trib
    May 31, 2018 @ 19:55
    Alex Skrypnyk
    2

    Hi Harry

    Querying with Descendants, DescendantsOrSelf is the worst traversing methods, avoid them.

    Read more about performance pitfalls - https://our.umbraco.org/documentation/reference/Common-Pitfalls/

    Thanks,

    Alex

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Jun 01, 2018 @ 07:25
    Dave Woestenborghs
    101

    Hi Harry,

    Depends on your site actually. If you only have 100 content items using descendants won't hurt your perfomance that much.

    But when you have 10000 content items this will become a bottle neck.

    I did a talk on how to optimize umbraco for speed. And also showed several alternatives to descendants.

    Slides can be found here : https://www.slideshare.net/dawoe/the-need-for-speed-uk-fest

    Also this article on the subject is interesting : https://skrift.io/articles/archive/testing-the-performance-of-querying-umbraco/

    But in the bottom line i avoid the use of descendants. Even a greed xpath query will give you better performance

    Dave

  • Harry Spyrou 212 posts 604 karma points
    Jun 01, 2018 @ 08:31
    Harry Spyrou
    0

    Exactly what I needed. Thanks so much!

Please Sign in or register to post replies

Write your reply to:

Draft