[libcxx-commits] [PATCH] D93233: [libc++] Replaces std::sort by Bitset sorting algorithm.
MinJae Hwang via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Dec 14 12:20:03 PST 2020
minjaehwang added a comment.
In D93233#2452760 <https://reviews.llvm.org/D93233#2452760>, @ldionne wrote:
> This is an interesting contribution. I'm trying to wrap my head around it.
> In D93233#2452718 <https://reviews.llvm.org/D93233#2452718>, @MaskRay wrote:
>> From a glance this uses a bitset partition and needs temporary storage (heap memory allocation?). Does the original algorithm have heap memory allocation?
> Unless I missed a subtlety, it doesn't require heap allocation. The "bitsets" used are actually 64 (or 32) bit integers. The current algorithm also doesn't have heap allocation, so keeping that property is something we want (and something this patch does AFAICT).
You are right. It only requires two 64 (or 32) bit integers to represent //bitsets// on left partition and right partition.
> @minjaehwang Is there documentation for this algorithm? I believe it would help us (at least myself) understand the algorithm and the potential tradeoffs involved. Also, are you aware of Timsort? IIRC there had been an analysis conducted that concluded that we should be using Timsort (as it was faster than our sort and respected the complexity requirements of the Standard).
I have the documentation which was intended to present in my employer. I will work with the company to publish the document.
I am aware of Timsort. Timsort is probably good for replacing std::stable_sort. It is a variant of merge sort and could be generally slower compared to unstable sorts.
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the libcxx-commits