Repository: flutter
Issue: Stuttering while scrolling PlatformViews only on iPhone 12 onwards (works on iPhone 7)
Labels: e: device-specific,platform-ios,engine,c: performance,a: platform-views,perf: speed,P2,team-ios,triaged-ios

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a performance problem, then fill out the template below.
     Please read our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Details

We have performance issues with `PlatformView`s inside `ListView` only on iPhone 12 onwards.  
Tested on iPhone 7, iPhone 7 iPhone 11, iPhone 12, iPhone 12 Pro, iPhone 13, iPhone 13 Pro and iPhone 14 Pro.

We can exclude ProMotion to be the culprit because iPhone 12, iPhone 12 Pro and iPhone 13 don't have it.

While scrolling on an iPhone 12 Pro we see strange **stuttering (vsync?)** with some slow raster phase that causes the frame rate to be unstable around 53/55 fps and sometimes drops to **48 fps**.

On iPhone 7 and iPhone 11 the issue is not present with a mostly stable framerate.

Sample project available at https://github.com/llooz/flutter_ads_list_perf.

We're able to offer any kind of support to help solve this issue.

Here are some video recordings and tracings:

| iphone 12 | iphone 7 | 
| -- | -- |
| <video src="https://github.com/flutter/flutter/assets/1781211/5014b803-992c-4701-a697-5ea57a2b48c1" /> | <video src="https://github.com/flutter/flutter/assets/1781211/a0826f56-03a6-4824-a743-1fb309df6469" /> |

[flutter-ads-perf-iphone-12-pro-trace.json.zip](https://github.com/flutter/flutter/files/11884382/flutter-ads-perf-iphone-12-pro-trace.json.zip)

[flutter-ads-perf-iphone-7-trace.json.zip](https://github.com/flutter/flutter/files/11884384/flutter-ads-perf-iphone-7-trace.json.zip)


<!--
1.  Please tell us exactly how to reproduce the problem you are running into.

2.  Please attach a small application (ideally just one main.dart file) that
     reproduces the problem. You could use https://gist.github.com/ for this.

3.  Switch flutter to master channel and run this app on a physical device
     using profile mode with Skia tracing enabled, as follows:
       flutter channel master
       flutter run --profile --trace-skia

     The bleeding edge master channel is encouraged here because Flutter is
     constantly fixing bugs and improving its performance. Your problem in an
     older Flutter version may have already been solved in the master channel.

4.  Record a video of the performance issue using another phone so we
     can have an intuitive understanding of what happened. Don’t use
     "adb screenrecord", as that affects the performance of the profile run.

5.  Open Flutter DevTools and save a timeline trace of the performance issue
     so we know which functions might be causing it. See "How to Collect
     and Read Timeline Traces" on this blog post:
       https://medium.com/flutter/profiling-flutter-applications-using-the-timeline-a1a434964af3#a499
     Make sure the performance overlay is turned OFF when recording the
     trace as that may affect the performance of the profile run.
     (Pressing ‘P’ on the command line toggles the overlay.)
-->

<!--
     Please tell us which target platform(s) the problem occurs (Android / iOS / Web / macOS / Linux / Windows)
     Which target OS version, for Web, browser, is the test system running?
     Does the problem occur on emulator/simulator as well as on physical devices?
-->

**Target Platform:** iOS
**Target OS version:** any
**Devices:** iPhone 12, iPhone 12 Pro, iPhone 13, iPhone 13 Pro, iPhone 14, iPhone 14 Pro

## Logs

<details>
<summary>Logs</summary>

<!-- Finally, paste the output of running `flutter doctor -v` here, with your device plugged in. -->


```
[✓] Flutter (Channel stable, 3.10.5, on macOS 13.3.1 22E772610a darwin-arm64,
    locale it-IT)
    • Flutter version 3.10.5 on channel stable at /Users/lucalooz/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 796c8ef792 (2 weeks ago), 2023-06-13 15:51:02 -0700
    • Engine revision 45f6e00911
    • Dart version 3.0.5
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/lucalooz/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • ANDROID_HOME = /Users/lucalooz/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/lucalooz/Library/Android/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.79.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.66.0

[✓] Connected device (4 available)
    • IdeaSolutions-iPhone7 (mobile) • 02b7b207ed91e990333780ea7254fa82e8156f4b
      • ios            • iOS 14.8 18H17
    • iPhone di Luca (2) (mobile)    • 00008101-001058A20A80001E
      • ios            • iOS 16.5.1 20F75
    • macOS (desktop)                • macos
      • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
    • Chrome (web)                   • chrome
      • web-javascript • Google Chrome 114.0.5735.133

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>