From 2d874177bc5394fdeebdec5eab4f91c2cb92e434 Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Wed, 2 Dec 2020 00:16:49 +0100 Subject: Avoid expensive build of tree when not using it --- ProcessList.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ProcessList.c b/ProcessList.c index 499f36a0..ada0451a 100644 --- a/ProcessList.c +++ b/ProcessList.c @@ -564,11 +564,13 @@ void ProcessList_scan(ProcessList* this, bool pauseProcessUpdate) { } } - // Clear out the hashtable to avoid any left-over processes from previous build - // - // The sorting algorithm relies on the fact that - // len(this->displayTreeSet) == len(this->processes) - Hashtable_clear(this->displayTreeSet); - - ProcessList_buildTree(this); + if (this->settings->treeView) { + // Clear out the hashtable to avoid any left-over processes from previous build + // + // The sorting algorithm relies on the fact that + // len(this->displayTreeSet) == len(this->processes) + Hashtable_clear(this->displayTreeSet); + + ProcessList_buildTree(this); + } } -- cgit v1.2.3