Skip to content

Allocate postings payload buffers only when the query requests them#16248

Open
slow-J wants to merge 1 commit into
apache:mainfrom
slow-J:payloadBufferAllocation
Open

Allocate postings payload buffers only when the query requests them#16248
slow-J wants to merge 1 commit into
apache:mainfrom
slow-J:payloadBufferAllocation

Conversation

@slow-J

@slow-J slow-J commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Currently the payloadLengthBuffer, payloadBytes, payload are allocated when indexHasPayloads, but are only read when needsPayloads. (Also needsPayloads depends on indexHasPayloads being true).

Gating the allocation on needsPayloads would bring payloads to parity with the buffers in needsOffsets and needsPos, saving some memory if the field stores payloads but the query does not request them.

posDeltaBuffer[i] = code >>> 1 had to be moved up a few lines so it is always called when indexHasPayloads (this is already the current behaviour).

Please let me know if I missed something.

@slow-J slow-J force-pushed the payloadBufferAllocation branch from 099fe90 to b8eac11 Compare June 11, 2026 14:23
@github-actions github-actions Bot added this to the 10.5.0 milestone Jun 11, 2026
@slow-J slow-J force-pushed the payloadBufferAllocation branch from b8eac11 to 486493b Compare June 11, 2026 14:28
@slow-J slow-J marked this pull request as ready for review June 11, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant