flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
165.72k stars 27.37k forks source link

[ios][platform_view]Use CALayer directly (rather than UIView) as the clip mask #149212

Open hellohuanlin opened 5 months ago

hellohuanlin commented 5 months ago

Use case

UIView comes with overhead unrelated to rendering (e.g. hit testing). As experimented in this design doc, there can be non-trivial performance improvement.

Decoupling this from the software rendering work allows us to (1) measure the improvement separately for a better understanding (2) land the software rendering PR sooner

Proposal

UIView::mask likely just calls CALayer::mask API. We should directly use CALayer to avoid extra overhead comes with UIView.

jmagman commented 1 week ago

It will be difficult to measure whether this improves things in our benchmarks until https://github.com/flutter/flutter/issues/155862 is resolved.