[libcxx-commits] [libcxx] 65dc0d4 - [libc++] Remove string benchmark for internal function

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 16 14:46:18 PST 2025


Author: Louis Dionne
Date: 2025-01-16T17:46:12-05:00
New Revision: 65dc0d44473481d67d34dcffd1037d2f9f0e574b

URL: https://github.com/llvm/llvm-project/commit/65dc0d44473481d67d34dcffd1037d2f9f0e574b
DIFF: https://github.com/llvm/llvm-project/commit/65dc0d44473481d67d34dcffd1037d2f9f0e574b.diff

LOG: [libc++] Remove string benchmark for internal function

We strive to keep our benchmarks portable, so we should only
benchmark standard APIs.

Added: 
    

Modified: 
    libcxx/test/benchmarks/containers/string.bench.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/benchmarks/containers/string.bench.cpp b/libcxx/test/benchmarks/containers/string.bench.cpp
index f7da3e2da312b7..0b62c87acf7a23 100644
--- a/libcxx/test/benchmarks/containers/string.bench.cpp
+++ b/libcxx/test/benchmarks/containers/string.bench.cpp
@@ -237,29 +237,6 @@ struct StringMove {
   static std::string name() { return "BM_StringMove" + Length::name(); }
 };
 
-template <class Length, class Opaque>
-struct StringResizeDefaultInit {
-  static void run(benchmark::State& state) {
-    constexpr bool opaque     = Opaque{} == Opacity::Opaque;
-    constexpr int kNumStrings = 4 << 10;
-    size_t length             = makeString(Length()).size();
-    std::string strings[kNumStrings];
-    while (state.KeepRunningBatch(kNumStrings)) {
-      state.PauseTiming();
-      for (int i = 0; i < kNumStrings; ++i) {
-        std::string().swap(strings[i]);
-      }
-      benchmark::DoNotOptimize(strings);
-      state.ResumeTiming();
-      for (int i = 0; i < kNumStrings; ++i) {
-        strings[i].__resize_default_init(maybeOpaque(length, opaque));
-      }
-    }
-  }
-
-  static std::string name() { return "BM_StringResizeDefaultInit" + Length::name() + Opaque::name(); }
-};
-
 template <class Length, class Opaque>
 struct StringAssignStr {
   static void run(benchmark::State& state) {
@@ -577,7 +554,6 @@ int main(int argc, char** argv) {
   makeCartesianProductBenchmark<StringCopy, AllLengths>();
   makeCartesianProductBenchmark<StringMove, AllLengths>();
   makeCartesianProductBenchmark<StringDestroy, AllLengths>();
-  makeCartesianProductBenchmark<StringResizeDefaultInit, AllLengths, AllOpacity>();
   makeCartesianProductBenchmark<StringEraseToEnd, AllLengths, AllOpacity>();
   makeCartesianProductBenchmark<StringEraseWithMove, AllLengths, AllOpacity>();
   makeCartesianProductBenchmark<StringRelational, AllRelations, AllLengths, AllLengths, AllDiffTypes>();


        


More information about the libcxx-commits mailing list