Browse Source

Switch benchmarks to match unit test namespacing. (#3268)

Specifically, rather than nesting them in `Carbon::Testing`, nest them
in `Carbon::Foo` for whatever component they're benchmarking. All our
current benchmarks are lexer benchmarks so its `Carbon::Lex`.

This makes even more sense for benchmarks than unittests I think.
Chandler Carruth 2 years ago
parent
commit
b8802035ed

+ 2 - 4
toolchain/lex/numeric_literal_benchmark.cpp

@@ -8,11 +8,9 @@
 #include "toolchain/diagnostics/null_diagnostics.h"
 #include "toolchain/diagnostics/null_diagnostics.h"
 #include "toolchain/lex/numeric_literal.h"
 #include "toolchain/lex/numeric_literal.h"
 
 
-namespace Carbon::Testing {
+namespace Carbon::Lex {
 namespace {
 namespace {
 
 
-using Lex::NumericLiteral;
-
 static void BM_Lex_Float(benchmark::State& state) {
 static void BM_Lex_Float(benchmark::State& state) {
   for (auto _ : state) {
   for (auto _ : state) {
     CARBON_CHECK(NumericLiteral::Lex("0.000001"));
     CARBON_CHECK(NumericLiteral::Lex("0.000001"));
@@ -49,4 +47,4 @@ BENCHMARK(BM_ComputeValue_Float);
 BENCHMARK(BM_ComputeValue_Integer);
 BENCHMARK(BM_ComputeValue_Integer);
 
 
 }  // namespace
 }  // namespace
-}  // namespace Carbon::Testing
+}  // namespace Carbon::Lex

+ 2 - 4
toolchain/lex/string_literal_benchmark.cpp

@@ -7,11 +7,9 @@
 #include "toolchain/diagnostics/null_diagnostics.h"
 #include "toolchain/diagnostics/null_diagnostics.h"
 #include "toolchain/lex/string_literal.h"
 #include "toolchain/lex/string_literal.h"
 
 
-namespace Carbon::Testing {
+namespace Carbon::Lex {
 namespace {
 namespace {
 
 
-using Lex::StringLiteral;
-
 static void BM_ValidString(benchmark::State& state, std::string_view introducer,
 static void BM_ValidString(benchmark::State& state, std::string_view introducer,
                            std::string_view terminator) {
                            std::string_view terminator) {
   std::string x(introducer);
   std::string x(introducer);
@@ -117,4 +115,4 @@ BENCHMARK(BM_SimpleStringValue_MultilineDoubleQuote);
 BENCHMARK(BM_SimpleStringValue_Raw);
 BENCHMARK(BM_SimpleStringValue_Raw);
 
 
 }  // namespace
 }  // namespace
-}  // namespace Carbon::Testing
+}  // namespace Carbon::Lex

+ 2 - 5
toolchain/lex/tokenized_buffer_benchmark.cpp

@@ -15,12 +15,9 @@
 #include "toolchain/lex/token_kind.h"
 #include "toolchain/lex/token_kind.h"
 #include "toolchain/lex/tokenized_buffer.h"
 #include "toolchain/lex/tokenized_buffer.h"
 
 
-namespace Carbon::Testing {
+namespace Carbon::Lex {
 namespace {
 namespace {
 
 
-using Lex::TokenizedBuffer;
-using Lex::TokenKind;
-
 // A large value for measurement stability without making benchmarking too slow.
 // A large value for measurement stability without making benchmarking too slow.
 // Needs to be a multiple of 100 so we can easily divide it up into percentages,
 // Needs to be a multiple of 100 so we can easily divide it up into percentages,
 // and 1% itself needs to not be too tiny. This makes 100,000 a great balance.
 // and 1% itself needs to not be too tiny. This makes 100,000 a great balance.
@@ -383,4 +380,4 @@ BENCHMARK(BM_ValidMix)
     ->Args({75, 10});
     ->Args({75, 10});
 
 
 }  // namespace
 }  // namespace
-}  // namespace Carbon::Testing
+}  // namespace Carbon::Lex