[PATCH] D36423: [libc++] Introsort based sorting function

DIVYA SHANMUGHAN via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 9 13:18:06 PDT 2017


DIVYA added a comment.

Link to algorithm.bench.cpp benchmark 
https://github.com/hiraditya/std-benchmark/blob/master/cxx/algorithm.bench.cpp



================
Comment at: include/algorithm:4208
+
+  // Threshold(or depth limit) for introsort is taken to be 2*log2(size)
+  typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
----------------
bcraig wrote:
> This comment says basically the same thing as the code.  The comment would be more useful if it said why 2*log2(size) is used.
We tested the code with depth limit from log2(size) to 4*log2(size).It was giving good performance around 2*log2(size).So the depth limit was fixed a this value.


https://reviews.llvm.org/D36423





More information about the cfe-commits mailing list