aboutsummaryrefslogtreecommitdiff
path: root/autotests/ksharedconfig_in_global_object.cpp
diff options
context:
space:
mode:
authorIgor Kushnir <igorkuo@gmail.com>2021-12-24 13:22:35 +0200
committerDavid Faure <faure@kde.org>2022-01-02 08:31:39 +0000
commit295ea7632ac7cc2cc3eda79b7af8614d5ff95a41 (patch)
tree8f3a3b8f8a870b54a3161f51e173740580d829ed /autotests/ksharedconfig_in_global_object.cpp
parentc0ad1374408c9acea8a4de6fd7d68563dcc89b2e (diff)
downloadkconfig-295ea7632ac7cc2cc3eda79b7af8614d5ff95a41.tar.gz
kconfig-295ea7632ac7cc2cc3eda79b7af8614d5ff95a41.tar.bz2
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. BUG: 384039 FIXED-IN: 5.90
Diffstat (limited to 'autotests/ksharedconfig_in_global_object.cpp')
0 files changed, 0 insertions, 0 deletions