summaryrefslogtreecommitdiff
path: root/absl/container
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2019-08-15 10:06:39 -0700
committerGravatar vslashg <gfalcon@google.com>2019-08-15 14:36:45 -0400
commitaae8143cf9aa611f70d7ea9b95b8b8b383b2271a (patch)
tree131d9bf69d90050cc21bdb5c35bca797c58dd5c6 /absl/container
parentd9aa92d7fb324314f9df487ac23d32a25650b742 (diff)
Export of internal Abseil changes
-- f28b989d5161230c6561e923b458c797a96bcf90 by Greg Falcon <gfalcon@google.com>: Import of CCTZ from GitHub. PiperOrigin-RevId: 263586488 -- 8259484025b7de45358719fc6182a48cac8044c6 by Andy Soffer <asoffer@google.com>: Internal changes and combine namespaces into a single namespace. PiperOrigin-RevId: 263560576 -- 8d19f41661984a600d1f8bbfeb8a30fcb4dee7d6 by Mark Barolak <mbar@google.com>: Inside of absl::string_view::copy, use absl::string_view::traits_type::copy instead of std:copy to do the actual work. This both follows the C++ standard more closely and avoids avoid MSVC unchecked iterator warnings. PiperOrigin-RevId: 263430502 -- c06bf74236e12c7c1c97bfcbbc9d29bd65d6b36c by Andy Soffer <asoffer@google.com>: Remove force-inlining attributes. Benchmarking results indicate that they are creating meaningful performance differences. PiperOrigin-RevId: 263364896 -- ec4fa6eac958a9521456201b138784f55d3b17bc by Abseil Team <absl-team@google.com>: Make BM_Fill benchmarks more representative. PiperOrigin-RevId: 263349482 -- 4ae280b4eb31d9cb58e847eb670473340f7778c1 by Derek Mauro <dmauro@google.com>: Fix new -Wdeprecated-copy warning in gcc9 PiperOrigin-RevId: 263348118 -- d238a92f452a5c35686f9c71596fdd1fe62090a2 by Matt Calabrese <calabrese@google.com>: The std::is_trivially_xxx fail on versions of GCC up until 7.4 due to faulty underlying intrinsics, but our emulation succeeds. Update our traits to not compare against the standard library implementation in these versions. PiperOrigin-RevId: 263209457 GitOrigin-RevId: f28b989d5161230c6561e923b458c797a96bcf90 Change-Id: I4c41db5928ba71e243aeace4420e06d1a2df0b5b
Diffstat (limited to 'absl/container')
-rw-r--r--absl/container/btree_test.cc2
-rw-r--r--absl/container/inlined_vector_benchmark.cc37
2 files changed, 22 insertions, 17 deletions
diff --git a/absl/container/btree_test.cc b/absl/container/btree_test.cc
index a330cca3..3ac97f89 100644
--- a/absl/container/btree_test.cc
+++ b/absl/container/btree_test.cc
@@ -323,6 +323,7 @@ class unique_checker : public base_checker<TreeType, CheckerType> {
unique_checker(const unique_checker &x) : super_type(x) {}
template <class InputIterator>
unique_checker(InputIterator b, InputIterator e) : super_type(b, e) {}
+ unique_checker& operator=(const unique_checker&) = default;
// Insertion routines.
std::pair<iterator, bool> insert(const value_type &x) {
@@ -370,6 +371,7 @@ class multi_checker : public base_checker<TreeType, CheckerType> {
multi_checker(const multi_checker &x) : super_type(x) {}
template <class InputIterator>
multi_checker(InputIterator b, InputIterator e) : super_type(b, e) {}
+ multi_checker& operator=(const multi_checker&) = default;
// Insertion routines.
iterator insert(const value_type &x) {
diff --git a/absl/container/inlined_vector_benchmark.cc b/absl/container/inlined_vector_benchmark.cc
index b99bbd62..3f2b4ed2 100644
--- a/absl/container/inlined_vector_benchmark.cc
+++ b/absl/container/inlined_vector_benchmark.cc
@@ -25,42 +25,45 @@
namespace {
void BM_InlinedVectorFill(benchmark::State& state) {
+ const int len = state.range(0);
absl::InlinedVector<int, 8> v;
- int val = 10;
+ v.reserve(len);
for (auto _ : state) {
+ v.resize(0); // Use resize(0) as InlinedVector releases storage on clear().
+ for (int i = 0; i < len; ++i) {
+ v.push_back(i);
+ }
benchmark::DoNotOptimize(v);
- v.push_back(val);
}
}
-BENCHMARK(BM_InlinedVectorFill)->Range(0, 1024);
+BENCHMARK(BM_InlinedVectorFill)->Range(1, 256);
void BM_InlinedVectorFillRange(benchmark::State& state) {
const int len = state.range(0);
- std::unique_ptr<int[]> ia(new int[len]);
- for (int i = 0; i < len; i++) {
- ia[i] = i;
- }
- auto* from = ia.get();
- auto* to = from + len;
+ const std::vector<int> src(len, len);
+ absl::InlinedVector<int, 8> v;
+ v.reserve(len);
for (auto _ : state) {
- benchmark::DoNotOptimize(from);
- benchmark::DoNotOptimize(to);
- absl::InlinedVector<int, 8> v(from, to);
+ benchmark::DoNotOptimize(src);
+ v.assign(src.begin(), src.end());
benchmark::DoNotOptimize(v);
}
}
-BENCHMARK(BM_InlinedVectorFillRange)->Range(0, 1024);
+BENCHMARK(BM_InlinedVectorFillRange)->Range(1, 256);
void BM_StdVectorFill(benchmark::State& state) {
+ const int len = state.range(0);
std::vector<int> v;
- int val = 10;
+ v.reserve(len);
for (auto _ : state) {
+ v.clear();
+ for (int i = 0; i < len; ++i) {
+ v.push_back(i);
+ }
benchmark::DoNotOptimize(v);
- benchmark::DoNotOptimize(val);
- v.push_back(val);
}
}
-BENCHMARK(BM_StdVectorFill)->Range(0, 1024);
+BENCHMARK(BM_StdVectorFill)->Range(1, 256);
// The purpose of the next two benchmarks is to verify that
// absl::InlinedVector is efficient when moving is more efficent than