Repository navigation
OAK-12451: Add single-level fast path to ListRecord.getEntry - #3206
Merged
Merged
Conversation
`ListRecord.getEntry(int)` recursed through a bucket even for single-level lists, allocating a throwaway single-element `ListRecord` per call — the hot path for reading a node's property records. This adds the `bucketSize == 1` branch that `getEntries(int, int, List)` already has, reading the record id directly. Isolates the per-entry overhead removed for a single-level list (the old path wrapped each entry in a throwaway `new ListRecord(id, 1)` + recursive `getEntry(0)`; both paths share the same underlying `readRecordId`): | | ns/op | B/op | |---|---|---| | old (wrapped ListRecord) | 1.33 | **24** | | new (fast path) | 0.38 | ~0 | → **24 B/op (one `ListRecord`) and ~1 ns eliminated per single-level `getEntry`**, called once per property read. Over a full traversal (~4.5B properties) that's on the order of ~100 GB of allocation avoided.
nfsantos
approved these changes
Oct 12, 2026
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.
https://issues.apache.org/jira/browse/OAK-12451
Summary
ListRecord.getEntry(int)went through a bucket even for single-level lists (bucketSize == 1), allocating a throwaway one-elementListRecordper call. This is the hot path for reading a node's property records.getEntries(int, int, List)already has abucketSize == 1branch; this adds the same branch togetEntry, reading the record ID directly.Benchmark (JMH 1.37, JDK 23)
Tests
RecordTest#testManyPropertiesRoundTripcovers single-level and multi-level property lists (1, 2, 255, 256, 300 and 1,000 properties).