[libcxx-commits] [PATCH] D127557: [libc++][ranges] Implement `ranges::sort`.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 15 09:09:48 PDT 2022

Mordante added inline comments.

Comment at: libcxx/benchmarks/algorithms/ranges_sort.bench.cpp:29
+           std::to_string(Quantity);
+  };
philnik wrote:
> I know it exists in the other benchmarks, but we don't have to continue this tradition.
What would you propose instead?

Comment at: libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/ranges.sort.pass.cpp:201
+    }
+  }
philnik wrote:
> var-const wrote:
> > Mordante wrote:
> > > Please add a test for the complexity.
> > `sort` doesn't perform a well-defined number of operations. Do you mean a test that checks that the number of comparisons is less than `N log(N)`? I'm not sure it's meaningful for a small `N`. Do we have any precedent for that? I don't see this being tested for the non-ranges version of `sort`. There are some complexity tests for the ranges algorithms, but all those that I remember were linear.
> > 
> I think the are also a few that aren't linear, but we never check complexity requirements for algorithms with big-O notation complexity.
The interesting part is this is the only sort algorithm expressed in terms of big-O :-(

I still think its good to test the number of comparisons and projections, but not a blocker.

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list