Optimization in GLCanvas3D::reload_scene():

Use sorting and binary search instead of linear search.
O(n log n) versus O(n^2)
This commit is contained in:
bubnikv 2019-12-10 11:12:17 +01:00
parent 24bbad634a
commit b12bc5c4d5
2 changed files with 11 additions and 15 deletions

View file

@ -303,6 +303,8 @@ public:
int instance_id;
bool operator==(const CompositeID &rhs) const { return object_id == rhs.object_id && volume_id == rhs.volume_id && instance_id == rhs.instance_id; }
bool operator!=(const CompositeID &rhs) const { return ! (*this == rhs); }
bool operator< (const CompositeID &rhs) const
{ return object_id < rhs.object_id || (object_id == rhs.object_id && (volume_id < rhs.volume_id || (volume_id == rhs.volume_id && instance_id < rhs.instance_id))); }
};
CompositeID composite_id;
// Fingerprint of the source geometry. For ModelVolumes, it is the ModelVolume::ID and ModelInstanceID,