[libcxx-commits] [libcxx] [libc++] Optimize lexicographical_compare (PR #65279)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 25 09:32:48 PDT 2024


================
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 <vector>
+
+template <class T>
+static void bm_lexicographical_compare(benchmark::State& state) {
----------------
ldionne wrote:

Please leave a comment saying that this benchmarks the worst case where `lexicographical_compare` returns `false` after comparing the whole sequences.

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


More information about the libcxx-commits mailing list