Re: [PATCH 0/5] Optimize number of comparisons for heap/heapsort implementaion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jan 21, 2024 at 11:21:06AM -0500, Kent Overstreet wrote:
> On Sun, Jan 21, 2024 at 11:36:44PM +0800, Kuan-Wei Chiu wrote:
> > 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(-)
> 
> Good stuff
> 
> While we're looking at this code, we should be doing some cleanup too -
> there's no reason for the heap code to be duplicated in bcache and
> bcachefs anymore, and it'd also be nice to get fs/bcachefs/eytzinger.h
> moved to include/linux and bcache converted to use it.
> 
> I also would not be surprised if there's another heap implementation in
> include/linux; we'll want to check for that and if there is decide which
> is worth keeping.
>
Yes, we have 'min_heap.h' in include/linux.

> Would you or Coli be interested in taking that on as well?




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux