After the introduction of hierarchical roles, the sorter will re-sort the entire role tree whenever the sort order might have changed. There are a number of ways in which this might be optimized. For example:
- When the allocation of a single client is changed, we can update that client's position in the sort order incrementally (via binary search + vector erase/insert), rather than re-sorting the entire tree.
- When the share of a part of the tree changes (e.g., weight), we can avoid re-sorting or re-calculating the share of tree nodes in an unrelated part of the tree.
Before making either of these changes, we should do some experimental work to better understand the current bottlenecks in sorter/allocator performance for real-world workloads.