[FIX] Performance of rebuild_spaces_from_geometry