Implement path compression
Implement path compression

This reduces the length of the path every time you search for an item, resulting in amortised logarithmic time instead of linear. We need rank ordering in order to make it constant.

Contributes to issue CURA-4017.

Ultimaker/CuraEngine,Ultimaker/CuraEngine,ROBO3D/CuraEngine,ROBO3D/CuraEngine,ROBO3D/CuraEngine