[patch] Faster selection with many objects
|Reported by:||bilbo||Owned by:||team|
When I select objects in editor, the selection is sorted and put into the selection list.
When number of objects is in order of tens of thousands or even hundreds of thousands, this sorting is very slow and causes a noticeable delay (several seconds)
I added a preference, "selection.fast_sort_above" with default of 10000.
If more objects than that is selected, fast comparator is used instead.
The fast comparator (compares only by ID and type) is approximately 2.5 times faster than old one (when having primitives with many complicated names, the speedup could be even higher). The sort order is worse from user's point of view (names are not taken into account), but when having 10000 objects in the small window with the list, the list is already quite unusable anyway ....
Also, in compareType is is not necessary to test for types being equal, as the function is never called for such arguments (compareName/compareId is used instead), so I removed the check, bringing further speedup.
I also added preference "selection.no_sort_above" with default value of 100000, above which there will be no sorting of the list, since with increasing number of objects, even the fast sort becomes slow.