Reduce JNI allocations when importing native maps - #58274
Open
javache wants to merge 1 commit into
Open
Conversation
|
@javache has exported this pull request. If you are a Meta employee, you can view the originating Diff in D118277119. |
javache
force-pushed
the
export-D118277119
branch
from
September 2, 2026 10:04
b79264e to
fec9d62
Compare
javache
added a commit
to javache/react-native
that referenced
this pull request
Sep 2, 2026
Summary: `ReadableNativeMap` materialization copied keys and created temporary JNI references for every imported type. Cache pointers to the stable native values and reuse global `ReadableType` references so importing maps and arrays does less allocation and lookup work. Changelog: [Internal] Differential Revision: D118277119
javache
added a commit
to javache/react-native
that referenced
this pull request
Sep 2, 2026
Summary: `ReadableNativeMap` materialization copied keys and created temporary JNI references for every imported type. Cache pointers to the stable native values and reuse global `ReadableType` references so importing maps and arrays does less allocation and lookup work. Changelog: [Internal] Differential Revision: D118277119
javache
force-pushed
the
export-D118277119
branch
from
September 2, 2026 11:06
fec9d62 to
90830fd
Compare
Summary: `ReadableNativeMap` materialization copied keys and created temporary JNI references for every imported type. Cache pointers to the stable native values and reuse global `ReadableType` references so importing maps and arrays does less allocation and lookup work. Writable maps can continue mutating after materialization because `folly::dynamic` stores object entries in reference-stable `F14NodeMap` nodes. Changelog: [Internal] Differential Revision: D118277119
javache
force-pushed
the
export-D118277119
branch
from
September 2, 2026 17:05
90830fd to
ec44686
Compare
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:
ReadableNativeMapmaterialization copied keys and created temporary JNI references for every imported type. Cache pointers to the stable native values and reuse globalReadableTypereferences so importing maps and arrays does less allocation and lookup work.Writable maps can continue mutating after materialization because
folly::dynamicstores object entries in reference-stableF14NodeMapnodes.Changelog: [Internal]
Differential Revision: D118277119