Visitar URL original
perf(ios): rebuild label text once per native update batch by triniwiz · Pull Request #11510 · NativeScript/NativeScript · GitHub
Skip to content

perf(ios): rebuild label text once per native update batch - #11510

Merged
NathanWalker merged 1 commit into
mainfrom
perf/ios-label-text-batch
Oct 6, 2026
Merged

NathanWalker merged 1 commit into
mainfrom
perf/ios-label-text-batch

Conversation

@triniwiz

@triniwiz triniwiz commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

PR Checklist

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).

Text, formatted text, decoration, transform, letter spacing, line height
and stroke setters each rebuilt the attributed text. When they apply
together (the initial apply, a CSS restyle), the rebuild now runs once
after the batch with the last call's reset flag. Calls outside a batch
rebuild immediately, as before.
@nx-cloud

nx-cloud Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit fd73e0c

Command Status Duration Result
nx run-many -t build -p core,webpack5,vite ✅ Succeeded 19s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-10-06 20:30:08 UTC

@pkg-pr-new

pkg-pr-new Bot commented Oct 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11510
npm i https://pkg.pr.new/@nativescript/vite@11510
npm i https://pkg.pr.new/@nativescript/webpack@11510

commit: fd73e0c

@NathanWalker
NathanWalker merged commit 093557b into main Oct 6, 2026
10 checks passed
@NathanWalker
NathanWalker deleted the perf/ios-label-text-batch branch October 6, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants