Skip to content

Commit 1ab64e4

Browse files
authored
[libc++][NFC] Simplify string.bench.cpp a bit (#169791)
This removes some dead code and simplifies an expression.
1 parent 4fd472c commit 1ab64e4

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

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

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -541,10 +541,7 @@ struct StringRead {
541541

542542
static bool skip() {
543543
// Huge does not give us anything that Large doesn't have. Skip it.
544-
if (Length() == ::Length::Huge) {
545-
return true;
546-
}
547-
return false;
544+
return Length() == ::Length::Huge;
548545
}
549546

550547
std::string name() const { return "BM_StringRead" + Temperature::name() + Depth::name() + Length::name(); }
@@ -585,14 +582,6 @@ void sanityCheckGeneratedStrings() {
585582
}
586583
}
587584

588-
// Some small codegen thunks to easily see generated code.
589-
bool StringEqString(const std::string& a, const std::string& b) { return a == b; }
590-
bool StringEqCStr(const std::string& a, const char* b) { return a == b; }
591-
bool CStrEqString(const char* a, const std::string& b) { return a == b; }
592-
bool StringEqCStrLiteralEmpty(const std::string& a) { return a == ""; }
593-
bool StringEqCStrLiteralSmall(const std::string& a) { return a == SmallStringLiteral; }
594-
bool StringEqCStrLiteralLarge(const std::string& a) { return a == LargeStringLiteral; }
595-
596585
int main(int argc, char** argv) {
597586
benchmark::Initialize(&argc, argv);
598587
if (benchmark::ReportUnrecognizedArguments(argc, argv))
@@ -615,16 +604,4 @@ int main(int argc, char** argv) {
615604
makeCartesianProductBenchmark<StringRelationalLiteral, AllRelations, AllLengths, AllLengths, AllDiffTypes>();
616605
makeCartesianProductBenchmark<StringRead, AllTemperatures, AllDepths, AllLengths>();
617606
benchmark::RunSpecifiedBenchmarks();
618-
619-
if (argc < 0) {
620-
// ODR-use the functions to force them being generated in the binary.
621-
auto functions = std::make_tuple(
622-
StringEqString,
623-
StringEqCStr,
624-
CStrEqString,
625-
StringEqCStrLiteralEmpty,
626-
StringEqCStrLiteralSmall,
627-
StringEqCStrLiteralLarge);
628-
printf("%p", &functions);
629-
}
630607
}

0 commit comments

Comments
 (0)