Repository navigation
Restrict sequence locks to multi-word flags and shrink mutation counts. - #2322
Draft
copybara-service[bot] wants to merge 1 commit into
Draft
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
copybara-service
Bot
force-pushed
the
test_1006216187
branch
9 times, most recently
from
October 30, 2026 20:39
31776db to
39f0f66
Compare
copybara-service
Bot
force-pushed
the
test_1006216187
branch
2 times, most recently
from
November 2, 2026 18:31
338cc7b to
943aeff
Compare
Any `absl::Flag` whose value fits in 8 bytes reads and writes its value atomically without consulting a sequence lock. Even so, every `absl::flags_internal::FlagImpl` in writable data previously paid 8 bytes for a sequence lock just to track modification counts for tests and flag savers. Move `SequenceLock` into the multi-word flag value storage specialization so only types larger than 8 bytes allocate it. Track mutations on `FlagImpl` with a 3-bit saturating counter inside an atomic state byte that overflows into a process-wide map after seven updates, shrinking the base object from 72 bytes to 64 bytes and scalar flags from 80 bytes to 72 bytes. PiperOrigin-RevId: 1006216187
copybara-service
Bot
force-pushed
the
test_1006216187
branch
from
November 2, 2026 18:36
943aeff to
d7a31a0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restrict sequence locks to multi-word flags and shrink mutation counts.
Any
absl::Flagwhose value fits in 8 bytes reads and writes its value atomically without consulting a sequence lock. Even so, everyabsl::flags_internal::FlagImplin writable data previously paid 8 bytes for a sequence lock just to track modification counts for tests and flag savers.Move
SequenceLockinto the multi-word flag value storage specialization so only types larger than 8 bytes allocate it. Track mutations onFlagImplwith a 3-bit saturating counter inside an atomic state byte that overflows into a process-wide map after seven updates, shrinking the base object from 72 bytes to 64 bytes and scalar flags from 80 bytes to 72 bytes.