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.
This commit is contained in:
Denis Lisov
2021-12-16 18:36:01 +03:00
committed by BenBE
parent 8d987864e4
commit 82dce5cf8e
2 changed files with 53 additions and 27 deletions

View File

@ -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
*/