Skip to content

Commit

Permalink
[libc++] Remove string benchmark for internal function
Browse files Browse the repository at this point in the history
We strive to keep our benchmarks portable, so we should only
benchmark standard APIs.
  • Loading branch information
ldionne committed Jan 16, 2025
1 parent edd1360 commit 65dc0d4
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions libcxx/test/benchmarks/containers/string.bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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>();
Expand Down

0 comments on commit 65dc0d4

Please sign in to comment.