Skip to content

OAK-12451: Add single-level fast path to ListRecord.getEntry - #3206

Merged
nfsantos merged 1 commit into
apache:trunkfrom
lweitzendorf:issue/OAK-12451
Oct 12, 2026
Merged

nfsantos merged 1 commit into
apache:trunkfrom
lweitzendorf:issue/OAK-12451

Conversation

@lweitzendorf

Copy link
Copy Markdown
Contributor

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-element ListRecord per call. This is the hot path for reading a node's property records. getEntries(int, int, List) already has a bucketSize == 1 branch; this adds the same branch to getEntry, reading the record ID directly.

Benchmark (JMH 1.37, JDK 23)

ns/op B/op
before 1.33 24
after 0.38 ~0

Tests

RecordTest#testManyPropertiesRoundTrip covers single-level and multi-level property lists (1, 2, 255, 256, 300 and 1,000 properties).

`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
nfsantos merged commit 9c7d6d0 into apache:trunk Oct 12, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants