From: David Sterba <dsterba@suse.cz>
To: Timofey Titovets <nefelim4ag@gmail.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2] Btrfs: heuristic replace heap sort with radix sort
Date: Mon, 4 Dec 2017 21:36:26 +0100 [thread overview]
Message-ID: <20171204203626.GD3553@twin.jikos.cz> (raw)
In-Reply-To: <20171203213033.28258-1-nefelim4ag@gmail.com>
On Mon, Dec 04, 2017 at 12:30:33AM +0300, Timofey Titovets wrote:
> Slowest part of heuristic for now is kernel heap sort()
> It's can take up to 55% of runtime on sorting bucket items.
>
> As sorting will always call on most data sets to get correctly
> byte_core_set_size, the only way to speed up heuristic, is to
> speed up sort on bucket.
>
> Add a general radix_sort function.
> Radix sort require 2 buffers, one full size of input array
> and one for store counters (jump addresses).
>
> That increase usage per heuristic workspace +1KiB
> 8KiB + 1KiB -> 8KiB + 2KiB
This is acceptable.
> That is LSD Radix, i use 4 bit as a base for calculating,
> to make counters array acceptable small (16 elements * 8 byte).
>
> That Radix sort implementation have several points to adjust,
> I added him to make radix sort general usable in kernel,
> like heap sort, if needed.
>
> Performance tested in userspace copy of heuristic code,
> throughput:
> - average <-> random data: ~3500 MiB/s - heap sort
> - average <-> random data: ~6000 MiB/s - radix sort
Sounds good!
> Changes:
> v1 -> v2:
> - Tested on Big Endian
> - Drop most of multiply operations
> - Separately allocate sort buffer
>
> Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
The code looks good, there are some coding style issues and we don't use
the uintX_t types, I'll fix that.
next prev parent reply other threads:[~2017-12-04 20:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-03 21:30 [PATCH v2] Btrfs: heuristic replace heap sort with radix sort Timofey Titovets
2017-12-04 20:36 ` David Sterba [this message]
2017-12-04 20:47 ` David Sterba
2017-12-04 21:24 ` Timofey Titovets
2017-12-05 7:55 ` Timofey Titovets
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171204203626.GD3553@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=nefelim4ag@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).