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
166.02k stars 27.41k forks source link

Regular spikes in frame rendering time using LeafRenderObjectWidget, RenderBox and a Ticker. #117539

Open vendik opened 1 year ago

vendik commented 1 year ago

Details

Regular spikes in frame rendering time during continuous rendering using LeafRenderObjectWidget, RenderBox and a Ticker. The spikes happen even if nothing is actually drawn on the canvas.

The spike visible in the profiler: 3

Exported timeline: 3.zip

Simplified example main.dart: https://gist.github.com/vendik/f9a257d64769348d7a023330802347cd

Simplified example project: test_game.zip

Target Platform: Android Target OS version/browser: Android 11 (also happens on Android 12) Devices: OnePlus 6 (also happens on Samsung S21)

Logs

Logs ``` No issues found! (ran in 1.6s) ``` ``` [√] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 6.3.9600], locale en-GB) • Flutter version 3.3.8 on channel stable at C:\Users\Admin\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 52b3dc25f6 (6 weeks ago), 2022-11-09 12:09:26 +0800 • Engine revision 857bd6b74c • Dart version 2.18.4 • DevTools version 2.15.0 [√] Android toolchain - develop for Android devices (Android SDK version 32.0.0) • Android SDK at C:\Users\Admin\AppData\Local\Android\sdk • Platform android-31, build-tools 32.0.0 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe [X] Visual Studio - develop for Windows X Visual Studio not installed; this is necessary for Windows development. Download at https://visualstudio.microsoft.com/downloads/. Please install the "Desktop development with C++" workload, including all of its default components [√] Android Studio (version 2021.3) • Android Studio at C:\Program Files\Android\Android Studio • 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 11.0.13+0-b1751.21-8125866) [√] IntelliJ IDEA Community Edition (version 2019.2) • IntelliJ at C:\Users\Admin\AppData\Local\JetBrains\IntelliJ IDEA Community Edition 2019.2.3 • 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 [√] Connected device (3 available) • ONEPLUS A6003 (mobile) • 7d061cf2 • android-arm64 • Android 11 (API 30) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 6.3.9600] • Chrome (web) • chrome • web-javascript • Google Chrome 108.0.5359.125 [√] HTTP Host Availability • All required HTTP hosts are available ! Doctor found issues in 1 category. ```
darshankawar commented 1 year ago

Thanks for the report. I see same behavior upon running the code in --profile mode wherein, saw spikes in performance overlay as below:

Screenshot 2022-12-23 at 12 03 33 PM
stable, master flutter doctor -v ``` [✓] Flutter (Channel stable, 3.3.10, on macOS 12.2.1 21D62 darwin-x64, locale en-GB) • Flutter version 3.3.10 on channel stable at /Users/dhs/documents/fluttersdk/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 135454af32 (15 hours ago), 2022-12-15 07:36:55 -0800 • Engine revision 3316dd8728 • Dart version 2.18.6 • DevTools version 2.15.0 [!] Xcode - develop for iOS and macOS (Xcode 12.3) • Xcode at /Applications/Xcode.app/Contents/Developer ! Flutter recommends a minimum Xcode version of 13. Download the latest version or update via the Mac App Store. • CocoaPods version 1.11.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] VS Code (version 1.62.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.21.0 [✓] Connected device (5 available) • SM G975F (mobile) • RZ8M802WY0X • android-arm64 • Android 11 (API 30) • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios • iOS 14.4.1 18D61 • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator) • macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.4 19E2269 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.80 [✓] HTTP Host Availability • All required HTTP hosts are available ! Doctor found issues in 1 category. [!] Flutter (Channel master, 3.7.0-13.0.pre.51, on macOS 12.2.1 21D62 darwin-x64, locale en-GB) • Flutter version 3.7.0-13.0.pre.51 on channel master at /Users/dhs/documents/fluttersdk/flutter ! Warning: `flutter` on your path resolves to /Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter. Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path. ! Warning: `dart` on your path resolves to /Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter. Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front of your path. • Upstream repository https://github.com/flutter/flutter.git • Framework revision 6441a7dc62 (3 hours ago), 2022-12-22 20:38:18 -0500 • Engine revision 12badb5459 • Dart version 3.0.0 (build 3.0.0-60.0.dev) • DevTools version 2.20.0 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [!] Xcode - develop for iOS and macOS (Xcode 12.3) • Xcode at /Applications/Xcode.app/Contents/Developer ! Flutter recommends a minimum Xcode version of 13. Download the latest version or update via the Mac App Store. • CocoaPods version 1.11.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] VS Code (version 1.62.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.21.0 [✓] Connected device (5 available) • SM G975F (mobile) • RZ8M802WY0X • android-arm64 • Android 11 (API 30) • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios • iOS 14.4.1 18D61 • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator) • macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.4 19E2269 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.80 [✓] HTTP Host Availability • All required HTTP hosts are available ! Doctor found issues in 1 category. ```