? ? Success

User tests: Successful: Unsuccessful:

avatar shandak
shandak
1 Jul 2018

Summary of Changes

Every nested tree node movement or rebuild usually executes quite a long time. Especially for the supertable #__assets.

New moveByReference changes will increase performance by changing only leaves which between a new and an old node positions and does it only in one query(only one update query). We don't need to compress the tree several times anymore. New changes only work with data which actually required for changes.

I got an enormous time execution difference inside my project with this changes.
Before it was executed by 587 seconds
and the same action with my changes was executed only by 18 seconds.

The query has a format like:

UPDATE `#__reditem_categories` SET lft = CASE WHEN lft BETWEEN 2 AND 3 THEN lft+4 WHEN lft BETWEEN 2 AND 7 THEN lft-2 ELSE lft END , rgt = CASE WHEN rgt BETWEEN 2 AND 3 THEN rgt+4 WHEN rgt BETWEEN 2 AND 7 THEN rgt-2 ELSE rgt END WHERE (lft BETWEEN 2 AND 7 OR rgt BETWEEN 2 AND 7)

New rebuild changes are also improving the process dramatically. It was tested with a broken #__asset table with more than 1 million records. I got the next results:
For full broken tree
before changes 671 sec
after my changes 39 sec

New delete and create changes just improve a process a bit. I've changed them for completely avoid an old approach related with _getTreeRepositionData. I completely removed it.

Testing Instructions

Every movement, rebuild, create and delete of nested tree entities(like category) must be as usual.

Expected result

Performance improvement for huge nested tree tables must be substantially fast than right now.

Actual result

Every nested tree node movement, rebuild usually executes quite a long time.

Documentation Changes Required

avatar shandak shandak - open - 1 Jul 2018
avatar shandak shandak - change - 1 Jul 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 1 Jul 2018
Category Libraries
avatar shandak shandak - change - 8 Jul 2018
Labels Added: ?
avatar shandak shandak - change - 8 Jul 2018
Title
performace improvement for moveByReference
performace improvement for moveByReference, rebuild, create and delete nested tree records
avatar shandak shandak - edited - 8 Jul 2018
avatar shandak shandak - change - 8 Jul 2018
Title
performace improvement for moveByReference
performace improvement for moveByReference, rebuild, create and delete nested tree records
avatar shandak shandak - change - 8 Jul 2018
The description was changed
avatar shandak shandak - edited - 8 Jul 2018
avatar joomla-cms-bot joomla-cms-bot - change - 9 Jul 2018
Category Libraries Libraries Unit Tests
avatar Hackwar
Hackwar - comment - 15 Jul 2018

Thank you for working on the nested sets code. I fear that this will not be really backwards compatible with the changed method names and thus would aim this directly at the 4.0 branch to be safe there.

While you are at it, could you also look into the code to store new ordering of items? Last time I looked, that code did some nasty stuff by simply deleting all rgt and lft values for the items to order, setting the order column to the values and then executing a rebuild(), instead of executing the right nested sets queries directly.

avatar shandak
shandak - comment - 15 Jul 2018

Thank you @Hackwar for your's feedback.
With regard to back compatibility, you told about removed _getTreeRepositionData yeah? If so I can turn it back and mark as deprecated. Will it be enough to release the code before 4.0? It seems it must be fully compatible with the current one.
And yeah, I'll rebuild 'new ordering of items' in the next PR.

avatar shandak shandak - change - 15 Jul 2018
Labels Added: ?
avatar shandak
shandak - comment - 15 Jul 2018

@Hackwar I turned back _getTreeRepositionData already

avatar csthomas
csthomas - comment - 25 Sep 2018

This can be very good improvement, I will try to find a time to test it.

avatar richard67
richard67 - comment - 27 Dec 2019

@shandak Could you update your branch with current staging and solve conflicts in file libraries/src/Table/Nested.php? Thanks in advance.

avatar shandak shandak - change - 30 Dec 2019
Labels Added: Conflicting Files
avatar shandak
shandak - comment - 30 Dec 2019

@richard67 conflicts solved

avatar shandak shandak - change - 6 Sep 2021
Labels Added: ? ?
Removed: ?
avatar laoneo
laoneo - comment - 25 Mar 2022

Sorry that it toke so long to respond. Performance improvements are always welcome in Joomla. But it needs proper testing, especially here as the changes do affect many extensions. As @Hackwar already mentioned, can you please rebase the pr on the branch 4.2-dev? In the meantime I'm closing the pr. When ready please reopen so we can get it tested. Thanks for your help making Joomla better.

avatar laoneo laoneo - change - 25 Mar 2022
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2022-03-25 16:44:52
Closed_By laoneo
avatar laoneo laoneo - close - 25 Mar 2022

Add a Comment

Login with GitHub to post a comment