Skip to content

Commit 67cab0c

Browse files
derekmaurocopybara-github
authored andcommitted
Cleanups related to benchmarks
* Fix many benchmarks to be cc_binary instead of cc_test * Add a few benchmarks for StrFormat * Add benchmarks for Substitute * Add benchmarks for Damerau-Levenshtein distance used in flags PiperOrigin-RevId: 738448552 Change-Id: I521f4b2ef9116c9895b44c32d27e94507380bee8
1 parent de292e8 commit 67cab0c

27 files changed

+330
-73
lines changed

absl/base/BUILD.bazel

+2-2
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,9 @@ cc_test(
699699
],
700700
)
701701

702-
cc_test(
702+
cc_binary(
703703
name = "thread_identity_benchmark",
704+
testonly = True,
704705
srcs = ["internal/thread_identity_benchmark.cc"],
705706
copts = ABSL_TEST_COPTS,
706707
linkopts = ABSL_DEFAULT_LINKOPTS,
@@ -710,7 +711,6 @@ cc_test(
710711
":base",
711712
"//absl/synchronization",
712713
"@google_benchmark//:benchmark_main",
713-
"@googletest//:gtest",
714714
],
715715
)
716716

absl/base/internal/thread_identity_benchmark.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include "benchmark/benchmark.h"
1615
#include "absl/base/internal/thread_identity.h"
1716
#include "absl/synchronization/internal/create_thread_identity.h"
1817
#include "absl/synchronization/internal/per_thread_sem.h"
18+
#include "benchmark/benchmark.h"
1919

2020
namespace {
2121

absl/container/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,5 @@ cc_binary(
11481148
"//absl/strings:str_format",
11491149
"//absl/time",
11501150
"@google_benchmark//:benchmark_main",
1151-
"@googletest//:gtest",
11521151
],
11531152
)

absl/container/btree_benchmark.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include <unordered_set>
2727
#include <vector>
2828

29-
#include "benchmark/benchmark.h"
3029
#include "absl/algorithm/container.h"
3130
#include "absl/base/internal/raw_logging.h"
3231
#include "absl/container/btree_map.h"
@@ -42,6 +41,7 @@
4241
#include "absl/strings/cord.h"
4342
#include "absl/strings/str_format.h"
4443
#include "absl/time/time.h"
44+
#include "benchmark/benchmark.h"
4545

4646
namespace absl {
4747
ABSL_NAMESPACE_BEGIN

absl/functional/BUILD.bazel

+2-2
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ cc_test(
146146
],
147147
)
148148

149-
cc_test(
149+
cc_binary(
150150
name = "function_type_benchmark",
151+
testonly = True,
151152
srcs = [
152153
"function_type_benchmark.cc",
153154
],
@@ -159,6 +160,5 @@ cc_test(
159160
":function_ref",
160161
"//absl/base:core_headers",
161162
"@google_benchmark//:benchmark_main",
162-
"@googletest//:gtest",
163163
],
164164
)

absl/functional/function_type_benchmark.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
#include <memory>
1717
#include <string>
1818

19-
#include "benchmark/benchmark.h"
2019
#include "absl/base/attributes.h"
2120
#include "absl/functional/any_invocable.h"
2221
#include "absl/functional/function_ref.h"
22+
#include "benchmark/benchmark.h"
2323

2424
namespace absl {
2525
ABSL_NAMESPACE_BEGIN

absl/numeric/BUILD.bazel

+2-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ cc_binary(
5656
"//absl/base:core_headers",
5757
"//absl/random",
5858
"@google_benchmark//:benchmark_main",
59-
"@googletest//:gtest",
6059
],
6160
)
6261

@@ -115,8 +114,9 @@ cc_test(
115114
],
116115
)
117116

118-
cc_test(
117+
cc_binary(
119118
name = "int128_benchmark",
119+
testonly = True,
120120
srcs = ["int128_benchmark.cc"],
121121
copts = ABSL_TEST_COPTS,
122122
linkopts = ABSL_DEFAULT_LINKOPTS,
@@ -125,7 +125,6 @@ cc_test(
125125
":int128",
126126
"//absl/base:config",
127127
"@google_benchmark//:benchmark_main",
128-
"@googletest//:gtest",
129128
],
130129
)
131130

absl/numeric/bits_benchmark.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#include <cstdint>
1616
#include <vector>
1717

18-
#include "benchmark/benchmark.h"
1918
#include "absl/base/optimization.h"
2019
#include "absl/numeric/bits.h"
2120
#include "absl/random/random.h"
21+
#include "benchmark/benchmark.h"
2222

2323
namespace absl {
2424
namespace {

absl/numeric/int128_benchmark.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
#include <random>
1919
#include <vector>
2020

21-
#include "benchmark/benchmark.h"
2221
#include "absl/base/config.h"
2322
#include "absl/numeric/int128.h"
23+
#include "benchmark/benchmark.h"
2424

2525
namespace {
2626

0 commit comments

Comments
 (0)