[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,140 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_remove_if = [](auto first, auto last, auto pred) { return std::remove_if(first, last, pred); };
+
+ // Benchmark {std,ranges}::remove_if on a sequence of the form xxxxxxxxxxyyyyyyyyyy
+ // where we remove the prefix of x's from the sequence.
+ //
+ // We perform this benchmark in a batch because we need to restore the
+ // state of the container after the operation.
+ {
+ auto bm = []<class Container>(std::string name, auto remove_if) {
----------------
philnik777 wrote:
Let's merge the benchmark families where it makes sense. e.g. merge `remove_if` and `remove`. They're basically the same benchmarks except for minor tweaks.
https://github.com/llvm/llvm-project/pull/127354
More information about the libcxx-commits
mailing list