Title: perf(ios): rebuild label text once per native update batch by triniwiz · Pull Request #11510 · NativeScript/NativeScript · GitHub
Open Graph Title: perf(ios): rebuild label text once per native update batch by triniwiz · Pull Request #11510 · NativeScript/NativeScript
X Title: perf(ios): rebuild label text once per native update batch by triniwiz · Pull Request #11510 · 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? On iOS, the setters for text, formatted text, decoration, transform, letter spacing, line height and stroke each rebuild the label's attributed text. When they apply together (the initial apply of a styled label, a CSS restyle), a label rebuilds it once per property. What is the new behavior? While native updates resume (onResumeNativeUpdates), the rebuild is deferred and runs once after the batch, with the last call's reset flag; the last call already decided the final text before. Calls outside a batch rebuild immediately, as before. New specs: a label with text, letter spacing and decoration rebuilds once per batch (3 times on main), and rebuilds immediately outside a batch. Numbers Only labels that set more than one of these properties benefit. In these scenarios that is text-flow, whose paragraphs set text and line height (two rebuilds each on main); labels elsewhere set only text and already rebuilt once. The other scenarios are flat within run-to-run noise. Scenario (M) Painted before Painted after Attach before Attach after flex-wrap-tiles 1169.1 1153.1 552.9 547.5 grid-dashboard 295.9 289.6 145.5 143.0 insert-remove 1157.4 1173.3 550.4 559.4 nested-chain 31.5 32.3 15.5 16.9 relayout-resize 339.5 340.8 121.0 121.8 relayout-style 331.6 335.1 118.8 121.3 styled-cards 384.2 384.6 195.7 191.6 text-flow 205.3 196.4 49.2 40.1 tree-fanout 333.0 335.3 118.5 119.0 Mutation (M) Before After restyle (relayout-style) 187.2 190.8 restore (relayout-style) 185.7 192.3 insert (insert-remove) 471.3 478.4 remove (insert-remove) 304.5 309.6 shrink (relayout-resize) 147.9 147.0 grow (relayout-resize) 146.7 147.3 How this was measured xplat-benchmarks ns-core app (plain core, no plugins), iPhone 17 Pro Max simulator, iOS 26.4. Each scenario mounts about 1,000 views at size M. Base and change were installed alternately for 3 rounds of 10 measured iterations, median ms, lower is better. "Attach" is assigning the built tree to a loaded parent (native view creation, CSS, native setters); "painted" ends one frame after layout. A GC is forced before each mutation, as it already is after each unmount, so a collection pause lands in the same phase for both builds. Part of a series: #11505, #11506, #11507, #11510 (this).
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/11510
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,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-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:bd73748b-49f9-6d2e-fdc0-fc81d2749f49 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9CDE:2E124E:14F7660:1AC0BDB:6B01335F |
| html-safe-nonce | 09a37f63bce2bfd4d5d81750f21fd9e5f46974766a1a66224d5fa735e06e32f9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0RFOjJFMTI0RToxNEY3NjYwOjFBQzBCREI6NkIwMTMzNUYiLCJ2aXNpdG9yX2lkIjoiODMyMTg4MjIzMTY5ODE3NDgxNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5711b2b94ee34788e9a15e8887ff6350405b7be8834efda6d34b6d71c1add64f |
| hovercard-subject-tag | pull_request:4764270168 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/NativeScript/NativeScript/pull/11510/files |
| twitter:image | https://avatars.githubusercontent.com/u/6695919?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/6695919?s=400&v=4 |
| og:image:alt | 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... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/NativeScript/NativeScript git https://github.com/NativeScript/NativeScript.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 31492490 |
| octolytics-dimension-repository_nwo | NativeScript/NativeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31492490 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/NativeScript |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width