perf: collect nested struct addresses once in field-major append#3661
Draft
andygrove wants to merge 3 commits intoapache:mainfrom
Draft
perf: collect nested struct addresses once in field-major append#3661andygrove wants to merge 3 commits intoapache:mainfrom
andygrove wants to merge 3 commits intoapache:mainfrom
Conversation
In append_struct_fields_field_major, the first pass now collects nested struct addresses and sizes alongside the null bitmap. The per-field second pass uses these pre-collected addresses instead of re-reading from the parent row pointer arrays and calling get_struct for every field of every row. For a struct with F fields and N rows, this reduces parent row pointer dereferences from N*F to N, and get_struct calls from N*F to N.
1 task
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.
Summary
append_struct_fields_field_major, the first pass now collects nested struct addresses and sizes alongside the null bitmappoint_to()instead of re-reading from parent row pointer arrays (read_row_at!) and callingget_struct()for every field of every rowRationale
Previously, for a struct with F fields and N rows, the code performed NF pointer dereferences into the parent row address/size arrays plus NF
get_struct()calls (each involvingget_offset_and_lenwhich reads an i64 and does bit manipulation). After this change, parent row reads andget_structcalls happen only N times total in the first pass, and the second pass uses cheappoint_to()calls with the cached addresses.Test plan
cargo clippy --all-targets --workspace -- -D warningspasses