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
Conversation
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* and effectiveBorder*Width;
- the
Background object 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 and Background. 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.
Copy link
Copy Markdown
|
View your CI Pipeline Execution ↗ for commit 1fdc8bb
| Command |
Status |
Duration |
Result |
nx test apps-automated -c=android |
✅ Succeeded |
3m 20s |
View ↗ |
nx run-many --target=test --configuration=ci --... |
✅ Succeeded |
<1s |
View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-11-01 03:00:33 UTC
|
Copy link
Copy Markdown
|
Open in StackBlitz
npm i https://pkg.pr.new/@nativescript/core@11595
npm i https://pkg.pr.new/@nativescript/vite@11595
npm i https://pkg.pr.new/@nativescript/webpack@11595
commit: 1fdc8bb
|
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
Labels
None yet
1 participant