[libcxx-commits] [libcxx] [libc++] Vectorize std::adjacent_find (PR #89757)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 18 08:42:06 PDT 2024


================
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include <algorithm>
+#include <benchmark/benchmark.h>
+#include <random>
+
+void BenchmarkSizes(benchmark::internal::Benchmark* Benchmark) {
+  Benchmark->DenseRange(1, 8);
+  for (size_t i = 16; i != 1 << 20; i *= 2) {
+    Benchmark->Arg(i - 1);
+    Benchmark->Arg(i);
+    Benchmark->Arg(i + 1);
+  }
+}
+
+// TODO: Look into benchmarking aligned and unaligned memory explicitly
+// (currently things happen to be aligned because they are malloced that way)
----------------
ldionne wrote:

I think it would be valuable to have these benchmarks before we check this in. I could check how the current implementation behaves on arm.

https://github.com/llvm/llvm-project/pull/89757


More information about the libcxx-commits mailing list