Repository navigation
Conversation
CreateJsWrapper only had a prototype cache for JS-extended classes (ClassPrototypes). Every other native object returned to JS rebuilt its prototype on each wrap: objc_getClass(meta->name()), the constructor template lookup, GetFunction, a new "prototype" string and a property Get. Without extra protocols the constructor template is cached per meta, so its prototype is fixed. MetaInstancePrototypes keeps it per meta and the wrap goes straight to SetPrototype.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
What
ArgConverter::CreateJsWrapperonly cached prototypes for JS-extended classes (ClassPrototypes). Every other native object returned to JS rebuilt its prototype on each wrap:objc_getClass(meta->name())GetFunction"prototype"V8 string and a propertyGetWithout extra protocols the constructor template is cached per meta, so its prototype never changes.
MetaInstancePrototypeskeeps it per meta; a wrap with no extra protocols now goes straight toSetPrototype. Wraps with extra protocols take the existing path.Measurements
iPhone 17 Pro simulator, xplat-benchmarks NativeScript app, size M, 5 interleaved rounds. Both builds come from this branch, with and without the change.
attachedis the mount phase up to the views being attached, B/A:Four of five rounds went the same way; one round was noisy in both directions. In a sampled profile of that app, this lookup chain was about 40% of
CreateJsWrapper.Testing
NativeScript.framework, swapped into the benchmark app; every benchmark round ran to completion.