[libcxx-commits] [PATCH] D151274: [libc++] Optimize for_each for segmented iterators

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 24 08:31:20 PDT 2023


ldionne requested changes to this revision.
ldionne added a comment.
This revision now requires changes to proceed.

LGTM but I'd like to see again with the test.



================
Comment at: libcxx/benchmarks/algorithms/for_each.bench.cpp:13
+
+static void bm_for_each(benchmark::State& state) {
+  std::deque<char> vec1(state.range(), '1');
----------------



================
Comment at: libcxx/include/__algorithm/for_each.h:1
 // -*- C++ -*-
 //===----------------------------------------------------------------------===//
----------------
Can we have a test that checks specifically `std::for_each` on a segmented iterator. Basically we can have a `libcxx/test/std` test that runs `for_each` on `deque` and explains that we're testing the interaction of `for_each` with segmented iterators. It'll be valid (but perhaps not *relevant*) for all implementations.


================
Comment at: libcxx/include/__algorithm/for_each.h:33
 
+#if _LIBCPP_STD_VER >= 20
+template <class _SegmentedIterator, class _Function>
----------------
I am fine with only optimizing this in C++20. This is QOI and we should be pushing folks towards newer Standards.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151274/new/

https://reviews.llvm.org/D151274



More information about the libcxx-commits mailing list