about summary refs log tree commit diff
path: root/absl/strings/string_view_benchmark.cc
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-10-22T18·04-0700
committerAshley Hedberg <ahedberg@google.com>2018-10-22T19·01-0400
commitc16d5557cd05119b5b7b1318ef778ebe3195b4a1 (patch)
tree35963478ea62b7d35bd1f72eb8cd81ca35677106 /absl/strings/string_view_benchmark.cc
parent45221ccc4ed643e4209b0cc5798e97203f108fa8 (diff)
Export of internal Abseil changes.
--
4e043a11b4c10a24e84046827ee16f47e11e35cc by Abseil Team <absl-team@google.com>:

Merge of https://github.com/abseil/abseil-cpp/pull/136

PiperOrigin-RevId: 218197648

--
e61f06e1e601061a443feaa8c5207c52437bd641 by Abseil Team <absl-team@google.com>:

Don't include <iostream> into int128, it's wasteful

Including iostream emits a global constructor for initializing std::cout and
friends, which isn't actually used by this file.

PiperOrigin-RevId: 218156386

--
8a6c82396e4c956be7f285328aec131cb4965f16 by Xiaoyi Zhang <zhangxy@google.com>:

Fix MSVC compiler warnings on discarding return values of functions with 'nodiscard'
attribute.

PiperOrigin-RevId: 217883401

--
abf3e3a0f22bc4070df9dbc9a4ef4d883ed686bf by Tom Manshreck <shreck@google.com>:

Update public README to add new libraries

PiperOrigin-RevId: 217879399

--
43b3b420a4e861711abbfbd497b8f2b3de17ec8c by Abseil Team <absl-team@google.com>:

Import of CCTZ from GitHub.

PiperOrigin-RevId: 217780963

--
1c8831947ca6a65a63842e6bd5f37a7c102a4e1b by Abseil Team <absl-team@google.com>:

Fix typo in a comment (missing comma in usage example).

PiperOrigin-RevId: 217776645
GitOrigin-RevId: 4e043a11b4c10a24e84046827ee16f47e11e35cc
Change-Id: I8999ae928da7a0030b4ecfd8d13da8522fdd013a
Diffstat (limited to 'absl/strings/string_view_benchmark.cc')
-rw-r--r--absl/strings/string_view_benchmark.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/absl/strings/string_view_benchmark.cc b/absl/strings/string_view_benchmark.cc
index fb46db18b3c3..f44203208fe4 100644
--- a/absl/strings/string_view_benchmark.cc
+++ b/absl/strings/string_view_benchmark.cc
@@ -151,7 +151,7 @@ void BM_find_string_view_len_one(benchmark::State& state) {
   std::string haystack(state.range(0), '0');
   absl::string_view s(haystack);
   for (auto _ : state) {
-    s.find("x");  // not present; length 1
+    benchmark::DoNotOptimize(s.find("x"));  // not present; length 1
   }
 }
 BENCHMARK(BM_find_string_view_len_one)->Range(1, 1 << 20);
@@ -160,7 +160,7 @@ void BM_find_string_view_len_two(benchmark::State& state) {
   std::string haystack(state.range(0), '0');
   absl::string_view s(haystack);
   for (auto _ : state) {
-    s.find("xx");  // not present; length 2
+    benchmark::DoNotOptimize(s.find("xx"));  // not present; length 2
   }
 }
 BENCHMARK(BM_find_string_view_len_two)->Range(1, 1 << 20);
@@ -169,7 +169,7 @@ void BM_find_one_char(benchmark::State& state) {
   std::string haystack(state.range(0), '0');
   absl::string_view s(haystack);
   for (auto _ : state) {
-    s.find('x');  // not present
+    benchmark::DoNotOptimize(s.find('x'));  // not present
   }
 }
 BENCHMARK(BM_find_one_char)->Range(1, 1 << 20);
@@ -178,7 +178,7 @@ void BM_rfind_one_char(benchmark::State& state) {
   std::string haystack(state.range(0), '0');
   absl::string_view s(haystack);
   for (auto _ : state) {
-    s.rfind('x');  // not present
+    benchmark::DoNotOptimize(s.rfind('x'));  // not present
   }
 }
 BENCHMARK(BM_rfind_one_char)->Range(1, 1 << 20);
@@ -193,7 +193,7 @@ void BM_worst_case_find_first_of(benchmark::State& state, int haystack_len) {
 
   absl::string_view s(haystack);
   for (auto _ : state) {
-    s.find_first_of(needle);
+    benchmark::DoNotOptimize(s.find_first_of(needle));
   }
 }