Skip to content

Add IntBuffer and DoubleBuffer entry types to MapBuffer (#57359)#57359

Open
javache wants to merge 1 commit into
react:mainfrom
javache:export-D109848476
Open

Add IntBuffer and DoubleBuffer entry types to MapBuffer (#57359)#57359
javache wants to merge 1 commit into
react:mainfrom
javache:export-D109848476

Conversation

@javache

@javache javache commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary:

Adds two new MapBuffer entry types, IntBuffer and DoubleBuffer, for storing homogeneous arrays of ints and doubles compactly in the dynamic data section. Unlike Map / map lists, these carry no per-element key/type overhead: a batch of N values costs ~N*elementSize bytes plus a single 4-byte count prefix instead of N 12-byte buckets. The bucket value holds the offset of the array within the dynamic data section.

Covers the full surface: the C++ reader (MapBuffer::getIntBuffer / getDoubleBuffer), the C++ builder (MapBufferBuilder::putIntBuffer / putDoubleBuffer), and the Kotlin reader API (MapBuffer.getIntBuffer / getDoubleBuffer, Entry.intBufferValue / doubleBufferValue). The DataType enum gains IntBuffer = 6 and DoubleBuffer = 7, kept in sync across C++ and Kotlin.

Changelog:
[General][Added] - Add IntBuffer and DoubleBuffer entry types to MapBuffer for compact homogeneous int/double arrays

Differential Revision: D109848476

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 29, 2026
@meta-codesync

meta-codesync Bot commented Jun 29, 2026

Copy link
Copy Markdown

@javache has exported this pull request. If you are a Meta employee, you can view the originating Diff in D109848476.

Summary:

Adds two new MapBuffer entry types, `IntBuffer` and `DoubleBuffer`, for storing homogeneous arrays of ints and doubles compactly in the dynamic data section. Unlike `Map` / map lists, these carry no per-element key/type overhead: a batch of N values costs ~N*elementSize bytes plus a single 4-byte count prefix instead of N 12-byte buckets. The bucket value holds the offset of the array within the dynamic data section.

Covers the full surface: the C++ reader (`MapBuffer::getIntBuffer` / `getDoubleBuffer`), the C++ builder (`MapBufferBuilder::putIntBuffer` / `putDoubleBuffer`), and the Kotlin reader API (`MapBuffer.getIntBuffer` / `getDoubleBuffer`, `Entry.intBufferValue` / `doubleBufferValue`). The `DataType` enum gains `IntBuffer = 6` and `DoubleBuffer = 7`, kept in sync across C++ and Kotlin.

Changelog:
[General][Added] - Add `IntBuffer` and `DoubleBuffer` entry types to MapBuffer for compact homogeneous int/double arrays

Differential Revision: D109848476
@meta-codesync meta-codesync Bot changed the title Add IntBuffer and DoubleBuffer entry types to MapBuffer Add IntBuffer and DoubleBuffer entry types to MapBuffer (#57359) Jun 29, 2026
@javache javache force-pushed the export-D109848476 branch from a7e7fd8 to d49129e Compare June 29, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant