Commit bedd1b1
authored
[iOS] SafeArea: Skip initial connection invalidation (#37841)
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!
## Description
Skips `InvalidateMeasure` from the iOS/Mac Catalyst `SafeAreaEdges`
mapper while a new handler is connecting. The initial layout pass
already reads the current safe-area value.
Reconnects and dynamic `SafeAreaEdges` changes retain the existing
invalidation behavior.
## Benchmark
The local Sandbox harness is not included in this PR. Release iOS
simulator, iPhone 16 Pro / iOS 18.4:
| Metric | Result |
|---|---:|
| Heavy tile `ToPlatform` (55 elements) | 12.841 ms |
| Flat tile `ToPlatform` (14 elements) | 4.735 ms |
| `SafeAreaEdges` mapper calls | 480 |
| `SafeAreaEdges` mapper total | <0.3 ms |
The attribution count includes mapper entries that return immediately.
This micro-optimization is below end-to-end simulator noise and no
aggregate speedup is claimed. The run completed all 70 benchmark results
with `run-end|ok`.
## Review
Independent GPT, Claude, and Gemini reviews traced the exact
`Connecting` / `Reconnecting` state flags, initial parent attachment,
non-default values, dynamic updates, and iOS/Mac Catalyst layout-time
safe-area reads. All three found the initial invalidation redundant and
the guard safe.
Copilot-Session: 5a03e13d-1a41-4652-a8c6-099eeb79cd501 parent 92dfb49 commit bedd1b1
1 file changed
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
157 | 162 | | |
158 | 163 | | |
159 | 164 | | |
| |||
0 commit comments