Repository navigation
Conversation
ide
force-pushed
the
@ide/mapbuffer-list-sizing
branch
2 times, most recently
from
December 4, 2026 12:35
653909a to
0c9bae9
Compare
ide
marked this pull request as ready for review
December 4, 2026 14:37
javache
reviewed
Dec 4, 2026
Comment on lines
+146
to
+152
| auto position = offset; | ||
| for (const auto& mapBuffer : mapBufferList) { | ||
| const auto mapBufferSize = static_cast<int32_t>(mapBuffer.size()); | ||
| memcpy(dynamicData_.data() + position, &mapBufferSize, INT_SIZE); | ||
| position += INT_SIZE; | ||
| memcpy(dynamicData_.data() + position, mapBuffer.data(), mapBufferSize); | ||
| position += mapBufferSize; |
Contributor
There was a problem hiding this comment.
nit: keep the explicit inline values of + pos and + pos + INT_SIZE so these don't become instruction dependencies.
Contributor
There was a problem hiding this comment.
position is never read after this, so the increment is wasted
Contributor
Author
There was a problem hiding this comment.
Done in 2b61eaa: both copies use position and position + INT_SIZE directly, and position advances once per child. The benchmark in the test plan is updated, and the numbers are slightly lower than before.
javache
requested changes
Dec 4, 2026
`putMapBufferList` grows its payload vector for each child. Sum the child sizes and their length prefixes, resize the vector once, then write the list in the existing format. The vector still grows geometrically across successive lists. The C++ `MapBufferTest` suite passes. One optimized Apple arm64 binary compares both serializers. Median retired instructions per list fall from 4,372 to 2,757 for five children and from 21,463 to 11,911 for 100 children. When one `MapBufferBuilder` writes 128 consecutive two-child lists, the median falls from 399 to 334 instructions per list. Encoded sizes and checksums match. Signed-off-by: James Ide <ide@expo.dev>
ide
force-pushed
the
@ide/mapbuffer-list-sizing
branch
from
December 4, 2026 19:13
0c9bae9 to
2b61eaa
Compare
javache
approved these changes
Dec 4, 2026
|
@javache has imported this pull request. If you are a Meta employee, you can view this in D136355128. |
This branch has not been deployed
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.
Summary:
putMapBufferListgrows its payload vector for each child. Sum the child sizes and their length prefixes, resize the vector once, then write the list in the existing format. The vector still grows geometrically across successive lists.Changelog:
[INTERNAL] [CHANGED] - Resize the MapBuffer payload once per list.
Test Plan:
The C++
MapBufferTestsuite passes. One optimized Apple arm64 binary compares both serializers. Median retired instructions per list fall from 4,372 to 2,757 for five children and from 21,463 to 11,911 for 100 children. When oneMapBufferBuilderwrites 128 consecutive two-child lists, the median falls from 399 to 334 instructions per list. Encoded sizes and checksums match.