Skip to content

Commit 2f25e6e

Browse files
Abseil Teamderekmauro
authored andcommitted
Export of internal Abseil changes
-- a7924266cefd1c175142545996c967fb18b6144f by Abseil Team <[email protected]>: Document the performance advantages of the `ToInt64*()` family of functions. PiperOrigin-RevId: 396736253 -- 77aa845d3aa4c56a48b899ce5a5ffcf9b81991b3 by Matt Kulukundis <[email protected]>: tiny cleanup: remove redundant `public:` PiperOrigin-RevId: 396615677 -- b837e3de0ebd99e4c4f692a80a5d7ece3e829d18 by Martijn Vels <[email protected]>: Make btree growth factor identical to concat code The btree code is using a more aggressive growth rate on Cord::Append than the Concat version. To minimize impact on migration and existing tests using empirical assumptions on growth, this change makes the btree use the same rate as Concat logic. PiperOrigin-RevId: 396595109 -- e958c06b6ab52e389caa7b3e43d83f924367e79c by Martijn Vels <[email protected]>: Change CordRepBtree::Dump to include capacity of flats PiperOrigin-RevId: 396591195 GitOrigin-RevId: a7924266cefd1c175142545996c967fb18b6144f Change-Id: Ia38c09ba9891364b0727509dec4776eb6aadf984
1 parent b2dc72c commit 2f25e6e

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

absl/profiling/internal/sample_recorder.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ namespace profiling_internal {
4141
// samples maintained by the SampleRecorder. Type T defines the sampled data.
4242
template <typename T>
4343
struct Sample {
44-
public:
4544
// Guards the ability to restore the sample to a pristine state. This
4645
// prevents races with sampling and resurrecting an object.
4746
absl::Mutex init_mu;

absl/strings/cord.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,8 +708,8 @@ void Cord::InlineRep::AppendArray(absl::string_view src,
708708
if (btree_enabled()) {
709709
// TODO(b/192061034): keep legacy 10% growth rate: consider other rates.
710710
rep = ForceBtree(rep);
711-
const size_t alloc_hint = (std::min)(kMaxFlatLength, rep->length / 10);
712-
rep = CordRepBtree::Append(rep->btree(), src, alloc_hint);
711+
const size_t min_growth = std::max<size_t>(rep->length / 10, src.size());
712+
rep = CordRepBtree::Append(rep->btree(), src, min_growth - src.size());
713713
} else {
714714
// Use new block(s) for any remaining bytes that were not handled above.
715715
// Alloc extra memory only if the right child of the root of the new tree

absl/strings/internal/cord_rep_btree.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ void DumpAll(const CordRep* rep, bool include_contents, std::ostream& stream,
9696
maybe_dump_data(rep);
9797
DumpAll(substring->child, include_contents, stream, depth + 1);
9898
} else if (rep->tag >= FLAT) {
99-
stream << "Flat, len = " << rep->length;
99+
stream << "Flat, len = " << rep->length
100+
<< ", cap = " << rep->flat()->Capacity();
100101
maybe_dump_data(rep);
101102
} else if (rep->tag == EXTERNAL) {
102103
stream << "Extn, len = " << rep->length;

absl/time/time.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,9 @@ Duration Hours(T n) {
480480
// ToInt64Hours()
481481
//
482482
// Helper functions that convert a Duration to an integral count of the
483-
// indicated unit. These functions are shorthand for the `IDivDuration()`
484-
// function above; see its documentation for details about overflow, etc.
483+
// indicated unit. These return the same results as the `IDivDuration()`
484+
// function, though they usually do so more efficiently; see the
485+
// documentation of `IDivDuration()` for details about overflow, etc.
485486
//
486487
// Example:
487488
//

0 commit comments

Comments
 (0)