U4-2925 - Tree performance is very poor in 6.1.x when having event subscriptions

Created by Shannon Deminick 25 Sep 2013, 00:09:41 Updated by Sebastiaan Janssen 30 Sep 2013, 12:50:29

If you subscribe to events:

BeforeTreeRender, AfterTreeRender for either the content/media trees then you will get n+1 performance issues.

With the changes in 6.1.x these trees render with the EntityService which should query much faster than the previous way, however if you subscribe to either of these events (and worse both) then for each rendered node it will do a full Document or Media lookup.

If you then also subscribe to RenderNode for either of these trees, then this same situation will also occur but you can slightly improve performance by overriding LoadMinimalDocument and set to true (though the performance gains will not be huge if you have a lot of child nodes).

To fix these we should just check for subscriptions to any of these events and if there are any than we need to render these trees the old way - or we can also load the child Document/Media items once and then pass these items into the events but this will mean that we have to both lookup entities and the real items.


Shannon Deminick 30 Sep 2013, 03:30:03

I've fixed this all up for both content/media trees by detecting if we can run in optimized mode or not. If we cannot run in optimized mode it will execute the legacy way by loading in document/media children - this will still be much faster than it is currently because we won't have n+1 problems. If we detect we can run optimized then it of course will be much faster.

Shannon Deminick 30 Sep 2013, 03:31:51

This has been fixed in a8f6b9eeb9ceebf6c2c85cbee4f526626beda8f6

Shannon Deminick 30 Sep 2013, 03:47:14

And updated again in : 15d2021786988a541620780fdc30cef38ec2e789, 4df79ce55b5bf3578aa3c01c1c2b4d7228fc2beb

Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions: 6.1.0, 6.1.1, 6.1.2, 6.1.3, 6.1.4, 6.1.5

Due in version: 6.1.6


Story Points: