From 82dce5cf8e241a46d4c9eae23423c63c5d1f17d2 Mon Sep 17 00:00:00 2001 From: Denis Lisov Date: Thu, 16 Dec 2021 18:36:01 +0300 Subject: ProcessList_buildTree: sort by parent for fast search ProcessList_buildTreeBranch used to search for children with a linear scan of the process table, which made tree build time quadratic in process count. Pre-sorting the list by parent PID (if known) makes it possible to select the correct slice by bisection much faster. --- Process.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Process.h') diff --git a/Process.h b/Process.h index d6a1f996..c2eb84be 100644 --- a/Process.h +++ b/Process.h @@ -255,6 +255,9 @@ typedef struct Process_ { unsigned int tree_depth; unsigned int tree_index; + /* Has no known parent process */ + bool isRoot; + /* * Internal state for merged Command display */ -- cgit v1.2.3