Skip to content

Optimize number of comparisons for heap/heapsort implementaion

Kuan-Wei Chiu linux-bcache linux-bcachefs lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5bcachefs: Optimize eytzinger0_sort() using bottom-up heapsortfs/bcachefs/util.c+30 -200 replies
2/5bcachefs: Introduce parent function for sort_cmp_size()fs/bcachefs/util.c+7 -03 replies
3/5bcachefs: Optimize sort_cmp_size() using bottom-up heapsortfs/bcachefs/util.c+35 -170 replies
4/5bcachefs: Optimize number of comparisons in heap_sift_downfs/bcachefs/util.h+13 -100 replies
5/5bcache: Optimize number of comparisons in heap_siftdrivers/md/bcache/util.h+13 -100 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/5] Optimize number of comparisons for heap/heapsort implementaion

Hello,

The existing implementations of heap/heapsort follow the conventional textbook approach, where each heapify operation requires approximately 2*log2(n) comparisons. In this series, I introduce a bottom-up variant that reduces the number of comparisons during heapify operations to approximately log2(n), while maintaining the same number of swap operations.

Thanks,
Kuan-Wei

Kuan-Wei Chiu (5):
bcachefs: Optimize eytzinger0_sort() using bottom-up heapsort
bcachefs: Introduce parent function for sort_cmp_size()
bcachefs: Optimize sort_cmp_size() using bottom-up heapsort
bcachefs: Optimize number of comparisons in heap_sift_down
bcache: Optimize number of comparisons in heap_sift

 drivers/md/bcache/util.h |  23 +++++----
 fs/bcachefs/util.c       | 109 ++++++++++++++++++++++++++-------------
 fs/bcachefs/util.h       |  23 +++++----
 3 files changed, 98 insertions(+), 57 deletions(-)
Signature · 1 line
2.25.1