diff options
author | Kuan-Wei Chiu <[email protected]> | 2024-10-20 12:01:52 +0800 |
---|---|---|
committer | Andrew Morton <[email protected]> | 2024-11-05 17:12:35 -0800 |
commit | aa5888afc2347ebb394c2c4b694fa3026775009e (patch) | |
tree | fa2fe284d915898ea6cc135e533185d3b21ab0c7 /scripts/gdb/linux/modules.py | |
parent | 92a8b224b833e82d286d2100432adbac8cf8a2a1 (diff) |
lib min_heap: optimize min heap by prescaling counters for better performance
Improve the efficiency of the min heap by prescaling counters, eliminating
the need to repeatedly compute 'index * element_size' when accessing
elements. By doing so, we avoid the overhead associated with
recalculating the byte offset for each heap operation.
However, with prescaling, the calculation for the parent element's
location is no longer as simple as '(i - 1) / 2'. To address this, we
copy the parent function from 'lib/sort.c', which calculates the parent
offset in a branchless manner without using any division instructions.
This optimization should result in a more efficient heap implementation by
reducing the computational overhead of finding parent and child offsets.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Kuan-Wei Chiu <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Ching-Chun (Jim) Huang <[email protected]>
Cc: Coly Li <[email protected]>
Cc: Ian Rogers <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Cc: Kent Overstreet <[email protected]>
Cc: "Liang, Kan" <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Matthew Sakai <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'scripts/gdb/linux/modules.py')
0 files changed, 0 insertions, 0 deletions