https://bugs.kde.org/show_bug.cgi?id=384039
David Faure <fa...@kde.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|ASSIGNED |RESOLVED Version Fixed In| |5.90 Latest Commit| |https://invent.kde.org/fram | |eworks/kconfig/commit/295ea | |7632ac7cc2cc3eda79b7af8614d | |5ff95a41 --- Comment #5 from David Faure <fa...@kde.org> --- Git commit 295ea7632ac7cc2cc3eda79b7af8614d5ff95a41 by David Faure, on behalf of Igor Kushnir. Committed on 02/01/2022 at 08:31. Pushed by dfaure into branch 'master'. Exclude deleted groups from groupList() This commit is an alternative to the earlier incorrect and reverted b3dc879e8b108c26c929bfbe551bcdf77f140e94. That commit contained several mistakes and an algorithmic complexity increase: 1) the added conditions were inverted: should have been `hasNonDeletedEntries` (without `!`); 2) KConfigPrivate::groupList() passed group instead of key.mGroup to hasNonDeletedEntries(); 3) The complexity of hasNonDeletedEntries() is O(entryMap.size()). Calls to this function were added into loops that iterated entryMap.size() times. So the overall complexity of groupList() 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. The `!key.mKey.isNull() && !entryMapIt->bDeleted` checks added in this commit are consistent with the check in KConfigPrivate::hasNonDeletedEntries(). KConfig::hasGroupImpl() forwards its argument to hasNonDeletedEntries() with the following comment: // No need to look for the actual group entry anymore, or for subgroups: // a group exists if it contains any non-deleted entry. FIXED-IN: 5.90 M +7 -1 autotests/kconfigtest.cpp M +2 -2 src/core/kconfig.cpp https://invent.kde.org/frameworks/kconfig/commit/295ea7632ac7cc2cc3eda79b7af8614d5ff95a41 -- You are receiving this mail because: You are watching all bug changes.