-
Notifications
You must be signed in to change notification settings - Fork 4.1k
perf(iavlx): use NodeID and absolute offsets in branch layout #25482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
technicallyty
wants to merge
8
commits into
aaronc/iavlx
Choose a base branch
from
technicallyty/iavlx/25474-relative-offsets
base: aaronc/iavlx
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+114
−142
Open
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
aa26a92
i think thats everything? i guess?
technicallyty ca2d85a
fix struct alignment
technicallyty 47c029a
remove leafOffsetRemappings and add a comment to offsetCache
technicallyty d4d932e
branch persisted removals and method removals
technicallyty e85a1aa
fully remove leafOffsetRemapping code
technicallyty 8585d2b
fix
technicallyty 09e0de9
fix resolve
technicallyty 93aa22c
some comments
technicallyty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -32,6 +32,7 @@ type Compactor struct { | |||
|
|
||||
| leafOffsetRemappings map[uint32]uint32 | ||||
| keyCache map[string]uint32 | ||||
| offsetCache map[NodeID]uint32 | ||||
|
|
||||
| // Running totals across all processed changesets | ||||
| leafOrphanCount uint32 | ||||
|
|
@@ -83,6 +84,7 @@ func NewCompacter(logger *slog.Logger, reader *Changeset, opts CompactOptions, s | |||
| versionsWriter: NewStructWriter[VersionInfo](newFiles.versionsFile), | ||||
| keyCache: make(map[string]uint32), | ||||
| leafOffsetRemappings: make(map[uint32]uint32), | ||||
|
||||
| leafOffsetRemappings: make(map[uint32]uint32), |
We no longer need this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah so I can see how this snippet looks totally equivalent to what I posted on slack! But the order actually matters and affects the struct size. So when we place NodeID (8 bytes) next to a uint32 (4 bytes), the compiler actually makes it take up 16 bytes with 4 bytes of padding. And if we do this twice, we use 32 bytes of space. If we put the offsets together, there is no extra padding and the same data only uses 24 bytes. If you're not too familiar with struct alignment and padding, there a bunch of articles you can find by googling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix struct alignment