[libcxx-commits] [libcxx] [libc++] Add remaining benchmarks from [alg.modifying.operations] (PR #127354)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Feb 24 13:22:35 PST 2025
================
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+
+#include <algorithm>
+#include <cstddef>
+#include <deque>
+#include <iterator>
+#include <list>
+#include <string>
+#include <vector>
+
+#include "benchmark/benchmark.h"
+#include "../../GenerateInput.h"
+
+int main(int argc, char** argv) {
+ auto std_rotate = [](auto first, auto middle, auto last) { return std::rotate(first, middle, last); };
+
+ // {std,ranges}::rotate(normal container)
+ {
+ auto bm = []<class Container>(std::string name, auto rotate) {
----------------
philnik777 wrote:
This is currently just benchmarking a special case, since the [begin, mid) and [mid, end) ranges have the same size. You probably also want to rotate by 1/3 and 1/4 as well as by a single element forward and backward.
https://github.com/llvm/llvm-project/pull/127354
More information about the libcxx-commits
mailing list