summaryrefslogtreecommitdiffstats
path: root/XUtils.c
diff options
context:
space:
mode:
authorCharlie Vieth <charlie.vieth@gmail.com>2022-02-05 18:47:43 -0500
committerBenBE <BenBE@geshi.org>2022-05-05 09:17:51 +0200
commit08166b27b191e7be62d74054d92a9720c3a141ab (patch)
treec5b839805f0565b11058ff7b7832b5fadfb4bc55 /XUtils.c
parentc7413fd6771b65388bea14ef42863444c6eaa419 (diff)
ProcessList: fix quadratic process removal when scanning
This commit changes ProcessList_scan to lazily remove Processes by index, which is known, instead of performing a brute-force search by pid and immediately reclaiming the lost vector space via compaction. Searching by pid is potentially quadratic in ProcessList_scan because the process we are searching for is always at the back of the vector (the scan starts from the back of the vector). Additionally, removal via Vector_remove immediately reclaims space (by sliding elements down). With these changes process removal in ProcessList_scan is now linear. Changes: * ProcessList: add new ProcessList_removeIndex function to remove by index * Vector: add Vector_softRemove and Vector_compact functions to support lazy removal/deletion of entries Vector_softRemove Vector_compact * Vector: replace Vector_count with Vector_countEquals since it only used for consistency assertions.
Diffstat (limited to 'XUtils.c')
0 files changed, 0 insertions, 0 deletions

© 2014-2024 Faster IT GmbH | imprint | privacy policy