Details
-
Type: Improvement
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.7
-
Fix Version/s: 4.7.16
-
Component/s: None
-
Labels:
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Funding Source:Contributed Code
-
Verified?:No
Description
The function getGroupsHierarchy in CRM_Contact_BAO_Group is performing very slow when a site has loads of groups.
This caused by the while loop and an array_merge in that loop (see https://github.com/civicrm/civicrm-core/blob/4.7.14/CRM/Contact/BAO/Group.php#L1150). Array merge is bad performing if one of the arrays contains more than 20 elements. This was the case at the socialist party their installation contains more than 2867 groups. The loop it self was called 2867 times and the array with $roots contained 775 elements.
The total duration of this function is around 800 ms.