Skip to content

Add MapBufferList entry type to MapBuffer (#57360)#57360

Open
javache wants to merge 2 commits into
react:mainfrom
javache:export-D109848477
Open

Add MapBufferList entry type to MapBuffer (#57360)#57360
javache wants to merge 2 commits into
react:mainfrom
javache:export-D109848477

Conversation

@javache

@javache javache commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary:

Introduces a dedicated MapBufferList DataType for an ordered array of nested MapBuffers, instead of overloading the Map type for lists. This makes a list of MapBuffers self-describing and distinguishable from a single nested Map (they were byte-distinct in payload but previously shared the Map type tag). Updates the C++ builder (putMapBufferList), the Kotlin MapBuffer interface, ReadableMapBuffer, and WritableMapBuffer, and adds cross-language JNI round-trip coverage in the serialization instrumentation test.

Changelog:
[Android][Added] - Add a dedicated MapBufferList type to MapBuffer for ordered lists of nested MapBuffers

Differential Revision: D109848477

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 D109848477.

Summary:
Pull Request resolved: react#57360

Introduces a dedicated `MapBufferList` `DataType` for an ordered array of nested MapBuffers, instead of overloading the `Map` type for lists. This makes a list of MapBuffers self-describing and distinguishable from a single nested `Map` (they were byte-distinct in payload but previously shared the `Map` type tag). Updates the C++ builder (`putMapBufferList`), the Kotlin `MapBuffer` interface, `ReadableMapBuffer`, and `WritableMapBuffer`, and adds cross-language JNI round-trip coverage in the serialization instrumentation test.

Changelog:
[Android][Added] - Add a dedicated `MapBufferList` type to `MapBuffer` for ordered lists of nested `MapBuffer`s

Differential Revision: D109848477
@meta-codesync meta-codesync Bot changed the title Add MapBufferList entry type to MapBuffer Add MapBufferList entry type to MapBuffer (#57360) Jun 29, 2026
@javache javache force-pushed the export-D109848477 branch from a7e7faa to 17a3186 Compare June 29, 2026 11:20
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