René's URL Explorer Experiment


Title: perf(ios): lay out views with fewer native calls by triniwiz · Pull Request #11544 · NativeScript/NativeScript · GitHub

Open Graph Title: perf(ios): lay out views with fewer native calls by triniwiz · Pull Request #11544 · NativeScript/NativeScript

X Title: perf(ios): lay out views with fewer native calls by triniwiz · Pull Request #11544 · NativeScript/NativeScript

Description: PR Checklist The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#commit-messages. There is an issue for the bug/feature this PR is for. To avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it. You have signed the CLA. All existing tests are passing: https://github.com/NativeScript/NativeScript/blob/master/tools/notes/DevelopmentWorkflow.md#running-unit-tests-application. Tests for the changes are included - https://github.com/NativeScript/NativeScript/blob/master/tools/notes/WritingUnitTests.md. What is the current behavior? Laying out a tree on iOS spends most of its time marshalling between JS and UIKit rather than in UIKit. Containers (layouts, ScrollView, Page content) default to iosOverflowSafeArea, so every time a container's frame changes, IOSHelper.expandBeyondSafeArea builds four CGRects (the safe area, the full area, the frame in the window, the frame) and reads each one back through getPositionFromFrame: about 70 native getter and struct calls per view, for a result that is the frame itself unless the view touches the edge of the safe area. Instrumenting core's layout methods in the xplat-benchmarks ns-core app (iOS simulator, a 1,093-view tree) showed each resize calling getPositionFromFrame about 5 times per view, and applySafeAreaInsets taking more time than all the measuring. What is the new behavior? The results are the same; the native calls are fewer. expandBeyondSafeArea reads each native value once (the reference scroll view's insets, content size and offset, or the controller's safe-area guide and frame; the view's location in the window; the frame) and computes the positions in JS with the same arithmetic. When nothing is expanded and the frame is already on device pixels, it returns the frame itself, and _modifyNativeViewFrame doesn't set it a second time. getAvailableSpaceFromParent is unchanged for other callers. layout() uses the position of a frame it has just set, unadjusted and untransformed, instead of reading the native frame back. A transformed view's frame is still read, since it is its transformed bounding box. layoutNativeView() skips the native calls when the position is the one it last laid out, which _setNativeViewFrame would leave alone anyway. getSafeAreaInsets() checks iosIgnoreSafeArea and the managed-inset ancestor before reading the native insets. layout.measureNativeView() and Label's text measure return plain objects instead of writing into the CGSize, which goes through native struct setters. Performance xplat-benchmarks ns-core app (plain core layouts, no plugins), iPhone 17 Pro Max simulator (iOS 26.4), size M, 3 interleaved rounds of 10 iterations, median ms until painted. To reproduce, point apps/ns-core at each build of core, build it with scripts/build-ios.sh ns-core, and run npm run bench -- run --platform ios --device --apps ns-core --scenarios mount,relayout --sizes M --rounds 3 (see the repo's README): Case main this PR main / PR relayout-resize grow 144.2 80.0 1.80 relayout-resize shrink 116.1 64.2 1.81 relayout-style restyle 171.7 102.9 1.67 relayout-style restore 141.3 90.6 1.56 insert-remove remove 277.4 178.3 1.56 insert-remove insert 364.1 281.4 1.29 tree-fanout mount 248.9 181.2 1.37 grid-dashboard mount 217.9 190.2 1.15 styled-cards mount 289.8 260.5 1.11 flex-wrap-tiles mount 817.5 742.8 1.10 nested-chain mount 24.5 22.8 1.07 text-flow mount 158.0 153.4 1.03 Tests view-helper/safe-area-expansion.spec.ts runs the new expandBeyondSafeArea and the previous computation (getAvailableSpaceFromParent + getPositionFromFrame) on 2,000 generated frames inside a scroll view and a view controller, with notched insets and fractional positions, and requires identical rects (over 200 of them expanded). view-helper/frame-position.spec.ts checks the JS position against reading it back from the frame. apps/automated passes on the iOS 26.4 simulator (1827 OK, 0 failed), including the 137 SAFEAREA layout, list view, scroll view, repeater and web view tests. The source changes are iOS-only (.ios.ts files, plus two declarations in view-helper/index.d.ts).

Open Graph Description: PR Checklist The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#commit-messages. There is an issue for the bug/feature this...

X Description: PR Checklist The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#commit-messages. There is an issue for the bug/feature this...

Opengraph URL: https://github.com/NativeScript/NativeScript/pull/11544

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:50a1bd85-9253-e20b-b4c7-de2218026ff8
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC4A2:1148D3:15482B9:1B325CE:6B0132FD
html-safe-noncec9a32a8415d947048f7b3c2d4bb7358939d7019d046b29965c353dacd98aa4c3
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNEEyOjExNDhEMzoxNTQ4MkI5OjFCMzI1Q0U6NkIwMTMyRkQiLCJ2aXNpdG9yX2lkIjoiODgzNDIyMzEzODA2NjczOTk2NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac843a3ed51891f637eb129c1aabf70e354014bfff99b2a4cca389b6a3a21025f8
hovercard-subject-tagpull_request:4874011560
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/NativeScript/NativeScript/pull/11544/files
twitter:imagehttps://avatars.githubusercontent.com/u/6695919?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/6695919?s=400&v=4
og:image:altPR Checklist The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#commit-messages. There is an issue for the bug/feature this...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/NativeScript/NativeScript git https://github.com/NativeScript/NativeScript.git
octolytics-dimension-user_id7392261
octolytics-dimension-user_loginNativeScript
octolytics-dimension-repository_id31492490
octolytics-dimension-repository_nwoNativeScript/NativeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id31492490
octolytics-dimension-repository_network_root_nwoNativeScript/NativeScript
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/NativeScript/NativeScript/pull/11544/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2FNativeScript%2Fpull%2F11544%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2FNativeScript%2Fpull%2F11544%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=NativeScript%2FNativeScript
Reloadhttps://github.com/NativeScript/NativeScript/pull/11544/files
Reloadhttps://github.com/NativeScript/NativeScript/pull/11544/files
Reloadhttps://github.com/NativeScript/NativeScript/pull/11544/files
NativeScripthttps://github.com/NativeScript
NativeScripthttps://github.com/NativeScript/NativeScript
Codehttps://github.com/NativeScript/NativeScript
Issues231 (231)https://github.com/NativeScript/NativeScript/issues
Pull requests107 (107)https://github.com/NativeScript/NativeScript/pulls
Discussionshttps://github.com/NativeScript/NativeScript/discussions
Actionshttps://github.com/NativeScript/NativeScript/actions
Projectshttps://github.com/NativeScript/NativeScript/projects
Wikihttps://github.com/NativeScript/NativeScript/wiki
Security and qualityhttps://github.com/NativeScript/NativeScript/security
Insightshttps://github.com/NativeScript/NativeScript/insights
Sign up for GitHub https://github.com/signup?return_to=%2FNativeScript%2FNativeScript%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FNativeScript%2FNativeScript%2Fissues%2Fnew%2Fchoose
triniwizhttps://github.com/triniwiz
mainhttps://github.com/NativeScript/NativeScript/tree/main
perf/ios-layout-native-readshttps://github.com/NativeScript/NativeScript/tree/perf/ios-layout-native-reads
Conversation 7 https://github.com/NativeScript/NativeScript/pull/11544
Commits 2 https://github.com/NativeScript/NativeScript/pull/11544/commits
Checks 8 https://github.com/NativeScript/NativeScript/pull/11544/checks
Files changed https://github.com/NativeScript/NativeScript/pull/11544/files
Please reload this pagehttps://github.com/NativeScript/NativeScript/pull/11544/files
perf(ios): lay out views with fewer native calls https://github.com/NativeScript/NativeScript/pull/11544/files#top
Show all changes 2 commits https://github.com/NativeScript/NativeScript/pull/11544/files
9fa576c perf(ios): lay out views with fewer native calls triniwiz Oct 15, 2026 https://github.com/NativeScript/NativeScript/pull/11544/commits/9fa576caa3392f562139ee6970a69a32885982fa
b24f3e8 chore(ios): drop comments triniwiz Oct 15, 2026 https://github.com/NativeScript/NativeScript/pull/11544/commits/b24f3e8bc7fafe331727f5b634ba0881ca719cf3
Clear filters https://github.com/NativeScript/NativeScript/pull/11544/files
Please reload this pagehttps://github.com/NativeScript/NativeScript/pull/11544/files
Please reload this pagehttps://github.com/NativeScript/NativeScript/pull/11544/files
index.ios.ts https://github.com/NativeScript/NativeScript/pull/11544/files#diff-025d8125f2c2388468769424324a18b7a896921f7b44f720db8014eb653b5f84
frame-position.spec.ts https://github.com/NativeScript/NativeScript/pull/11544/files#diff-68debe3f5d00cc54b6066526fb56bf79a5ecfe1df570ebea653f9163264dd04a
index.d.ts https://github.com/NativeScript/NativeScript/pull/11544/files#diff-7403a234acab04bcac02dc57a08664519c27acdb981063263f126de5c27a060f
index.ios.ts https://github.com/NativeScript/NativeScript/pull/11544/files#diff-83c9fab79b1de3837e713014b8b8a21b7c428d1efbd5b0e36f3aba51cf3b4db4
safe-area-expansion.spec.ts https://github.com/NativeScript/NativeScript/pull/11544/files#diff-6b857a55d70f20d31013ef30ed8a3942146f19c78972218250aca0897621058f
index.ios.ts https://github.com/NativeScript/NativeScript/pull/11544/files#diff-76c9d9f373ad8551d3dc713ec3ccef84d62bdc25b6064498257ffa89ed7a76ee
index.ios.ts https://github.com/NativeScript/NativeScript/pull/11544/files#diff-c6a5ba202b74615cf88735f98a7d05c8c4a7ef7a61e6475af18373560a68a7b7
packages/core/ui/core/view/index.ios.tshttps://github.com/NativeScript/NativeScript/pull/11544/files#diff-025d8125f2c2388468769424324a18b7a896921f7b44f720db8014eb653b5f84
View file https://github.com/NativeScript/NativeScript/blob/b24f3e8bc7fafe331727f5b634ba0881ca719cf3/packages/core/ui/core/view/index.ios.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/NativeScript/pull/11544/{{ revealButtonHref }}
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-025d8125f2c2388468769424324a18b7a896921f7b44f720db8014eb653b5f84
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-025d8125f2c2388468769424324a18b7a896921f7b44f720db8014eb653b5f84
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-025d8125f2c2388468769424324a18b7a896921f7b44f720db8014eb653b5f84
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-025d8125f2c2388468769424324a18b7a896921f7b44f720db8014eb653b5f84
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-025d8125f2c2388468769424324a18b7a896921f7b44f720db8014eb653b5f84
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-025d8125f2c2388468769424324a18b7a896921f7b44f720db8014eb653b5f84
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-025d8125f2c2388468769424324a18b7a896921f7b44f720db8014eb653b5f84
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-025d8125f2c2388468769424324a18b7a896921f7b44f720db8014eb653b5f84
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-025d8125f2c2388468769424324a18b7a896921f7b44f720db8014eb653b5f84
farfromrefughttps://github.com/farfromrefug
Oct 15, 2026https://github.com/NativeScript/NativeScript/pull/11544/files#r4284730949
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/NativeScript/NativeScript/pull/11544/files
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-025d8125f2c2388468769424324a18b7a896921f7b44f720db8014eb653b5f84
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-025d8125f2c2388468769424324a18b7a896921f7b44f720db8014eb653b5f84
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-025d8125f2c2388468769424324a18b7a896921f7b44f720db8014eb653b5f84
farfromrefughttps://github.com/farfromrefug
Oct 15, 2026https://github.com/NativeScript/NativeScript/pull/11544/files#r4284742102
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/NativeScript/NativeScript/pull/11544/files
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-025d8125f2c2388468769424324a18b7a896921f7b44f720db8014eb653b5f84
packages/core/ui/core/view/view-helper/frame-position.spec.tshttps://github.com/NativeScript/NativeScript/pull/11544/files#diff-68debe3f5d00cc54b6066526fb56bf79a5ecfe1df570ebea653f9163264dd04a
View file https://github.com/NativeScript/NativeScript/blob/b24f3e8bc7fafe331727f5b634ba0881ca719cf3/packages/core/ui/core/view/view-helper/frame-position.spec.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/NativeScript/pull/11544/{{ revealButtonHref }}
packages/core/ui/core/view/view-helper/index.d.tshttps://github.com/NativeScript/NativeScript/pull/11544/files#diff-7403a234acab04bcac02dc57a08664519c27acdb981063263f126de5c27a060f
View file https://github.com/NativeScript/NativeScript/blob/b24f3e8bc7fafe331727f5b634ba0881ca719cf3/packages/core/ui/core/view/view-helper/index.d.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/NativeScript/pull/11544/{{ revealButtonHref }}
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-7403a234acab04bcac02dc57a08664519c27acdb981063263f126de5c27a060f
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-7403a234acab04bcac02dc57a08664519c27acdb981063263f126de5c27a060f
packages/core/ui/core/view/view-helper/index.ios.tshttps://github.com/NativeScript/NativeScript/pull/11544/files#diff-83c9fab79b1de3837e713014b8b8a21b7c428d1efbd5b0e36f3aba51cf3b4db4
View file https://github.com/NativeScript/NativeScript/blob/b24f3e8bc7fafe331727f5b634ba0881ca719cf3/packages/core/ui/core/view/view-helper/index.ios.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/NativeScript/pull/11544/{{ revealButtonHref }}
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-83c9fab79b1de3837e713014b8b8a21b7c428d1efbd5b0e36f3aba51cf3b4db4
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-83c9fab79b1de3837e713014b8b8a21b7c428d1efbd5b0e36f3aba51cf3b4db4
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-83c9fab79b1de3837e713014b8b8a21b7c428d1efbd5b0e36f3aba51cf3b4db4
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-83c9fab79b1de3837e713014b8b8a21b7c428d1efbd5b0e36f3aba51cf3b4db4
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-83c9fab79b1de3837e713014b8b8a21b7c428d1efbd5b0e36f3aba51cf3b4db4
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-83c9fab79b1de3837e713014b8b8a21b7c428d1efbd5b0e36f3aba51cf3b4db4
packages/core/ui/core/view/view-helper/safe-area-expansion.spec.tshttps://github.com/NativeScript/NativeScript/pull/11544/files#diff-6b857a55d70f20d31013ef30ed8a3942146f19c78972218250aca0897621058f
View file https://github.com/NativeScript/NativeScript/blob/b24f3e8bc7fafe331727f5b634ba0881ca719cf3/packages/core/ui/core/view/view-helper/safe-area-expansion.spec.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/NativeScript/pull/11544/{{ revealButtonHref }}
packages/core/ui/label/index.ios.tshttps://github.com/NativeScript/NativeScript/pull/11544/files#diff-76c9d9f373ad8551d3dc713ec3ccef84d62bdc25b6064498257ffa89ed7a76ee
View file https://github.com/NativeScript/NativeScript/blob/b24f3e8bc7fafe331727f5b634ba0881ca719cf3/packages/core/ui/label/index.ios.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/NativeScript/pull/11544/{{ revealButtonHref }}
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-76c9d9f373ad8551d3dc713ec3ccef84d62bdc25b6064498257ffa89ed7a76ee
https://github.com/NativeScript/NativeScript/pull/11544/files#diff-76c9d9f373ad8551d3dc713ec3ccef84d62bdc25b6064498257ffa89ed7a76ee
Please reload this pagehttps://github.com/NativeScript/NativeScript/pull/11544/files
Please reload this pagehttps://github.com/NativeScript/NativeScript/pull/11544/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.