Exclude deleted groups from groupList()
This commit is an alternative to the earlier incorrect and reverted b3dc879e. That commit contained several mistakes and an algorithmic complexity increase:
- the added conditions were inverted: should have been
hasNonDeletedEntries
(without!
); -
KConfigPrivate::groupList()
passedgroup
instead ofkey.mGroup
tohasNonDeletedEntries()
; - The complexity of
hasNonDeletedEntries()
is O(entryMap.size()
). Calls to this function were added into loops that iteratedentryMap.size()
times. So the overall complexity ofgroupList()
increased from linear to quadratic.
This fix collects mGroup
s of non-deleted key entries instead of
mGroup
s of group entries. The number of key entries can be much
greater than the number of group entries, so this fix hurts performance.
But at least the algorithmic complexity of groupList()
stays linear.
Future commits can optimize the loops and make them almost as fast or
even faster than before this fix.
BUG: 384039
FIXED-IN: 5.90