perf(core): let views that paint their own box styles skip derived box state by triniwiz · Pull Request #11595 · NativeScript/NativeScript
Repository navigation
perf(core): let views that paint their own box styles skip derived box state - #11595
Draft
triniwiz wants to merge 1 commit into main from perf/own-box-style
Draft
perf(core): let views that paint their own box styles skip derived box state #11595 triniwiz wants to merge 1 commit into main from perf/own-box-style
Conversation
triniwiz commented Nov 1, 2026
Copy link Copy Markdown
Member
Lets a view tell core it paints its own padding, borders and backgrounds, so core can skip the state it would derive from them.
What changes
A view can set _appliesOwnBoxStyle = true. For those views:
- style values are stored, read back and cascaded exactly as before;
- core skips the derived state it builds from them:
effectivePadding*andeffectiveBorder*Width;- the
Backgroundobject it rebuilds on every background, border, radius, box-shadow or clip-path change.
Views that don't set the flag behave exactly as before.
The use case is a layout plugin that draws boxes itself. @triniwiz/nativescript-masonkit paints these properties natively and never reads the derived state, but core still rebuilt it for every declaration on every view. Older cores ignore the flag, so the plugin can set it unconditionally.
Numbers
xplat-benchmarks ns-core-mason-perf, with masonkit setting the flag, size M, interleaved runs. Time to attach:
| scenario | iOS simulator | Android emulator |
|---|---|---|
| styled-cards | 0.93 | 0.90 |
| tree-fanout | 0.94 | 0.95 |
| flex-wrap-tiles | 0.95 | 0.96 |
| grid-dashboard | 0.95 | n/a |
Screenshots were identical.
Testing
- New
own-box-style.spec.ts. A flagged view keeps its style values but skips the derived paddings, border widths andBackground. An unflagged view still derives them. - All core unit tests pass (645).
perf(core): let views that paint their own box styles skip derived bo...
1fdc8bb
...x state A view can set _appliesOwnBoxStyle to tell core it applies its own padding, borders, border radii, backgrounds, box shadows and clip path. For those views the style values are still stored and read back as usual, but core skips the state it derives from them (effective paddings and border widths, and the Background object rebuilt on each change). Views that don't set the flag behave exactly as before.
nx-cloud
Bot
commented
Nov 1, 2026
·
edited
Loading
Copy link Copy Markdown
|
View your CI Pipeline Execution ↗ for commit 1fdc8bb
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
pkg-pr-new
Bot
commented
Nov 1, 2026
Copy link Copy Markdown
commit: |
This branch has not been deployed
No deployments
Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment