Open
Conversation
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.
What's Changed
A significant number of ArrowBuf and BufferLedger objects are created during certain workloads. Saving several bytes per instance could add up to significant memory savings and reduced memory allocation expense and garbage collection.
The id field, which was a sequential value used when logging object information, is replaced with an identity hash code. This should still allow enough information for debugging without the memory overhead. There may be possible duplicate values but it shouldn't matter for logging purposes.
Atomic fields can be replaced by a primitive and a static updater which saves several bytes per instance.
ArrowBuf
idGenerator(static)AtomicLongidfield (per instance)long(8 bytes)getId()idfieldSystem.identityHashCode(this)BufferLedger
LEDGER_ID_GENERATOR(static)AtomicLongledgerId(per instance)long(8 bytes)bufRefCntAtomicInteger(24 bytes)volatile int+ static updaterTotal Savings
Benchmarking
I ran the added benchmark before and after the metadata trimming.
Metadata Trimmed
Previous Object Layout
Closes #1038.