Not able to determine time taken by Dart VM initialisation
- Dominant language
- Dart
- Stars
- 1.7k
- Forks
- 404
- Avg merge
- 6d 17h
- Merged PRs (30d)
- 18
Description
I am tracing app startup for Android device (Samsung Galaxy m51), In flutter devtools, I can see Warm-up frame at 4s 52ms 432us.
I am trying to analyse this delay and therefore need to find time taken by Dart VM initialisation as I am suspecting that could be one culprit.
In logs I can see a gap of 3.107s in MainActivity OnResume to main.dart first statement execution.
In Dev tools I can see gap of 4.52s before Warm-up frame and our own code execution.
I also added custom timeline traces in main.dart first line itself, its starting at ~4s
I am trying to verify if both are pointing to same delay.
As per my understanding Dart VM startup is somewhere between this time.
In another run I tried with '--trace-startup --profile'
in the startuptimeline.json i got :
{
"name": "DartVMInitializer",
"cat": "Embedder",
"tid": 4139,
"pid": 4139,
"ts": 14740213596,
"ph": "E",
"args": {}
},
this seems to be an end event but there is no subsequent start event in that file.
In dev tools I am not able to see much between FlutterEngineMainEnter and Warm-up frame.
Flutter doctor :
Flutter doctor results :
[✓] Flutter (Channel stable, 3.13.4, on macOS 14.0 23A344 darwin-arm64, locale en-IN)
• Flutter version 3.13.4 on channel stable at /Users/hrishikeshrajwade/Downloads/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 367f9ea16b (2 months ago), 2023-09-12 23:27:53 -0500
• Engine revision 9064459a8b
• Dart version 3.1.2
• DevTools version 2.25.0
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at /Users/hrishikeshrajwade/Library/Android/sdk
• Platform android-33, build-tools 32.1.0-rc1
• 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.6b829.9-10027231)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15A507
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.3)
• 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.6b829.9-10027231)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.1)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 73.0.4
• Dart plugin version 231.8109.91
[✓] VS Code (version 1.71.2)
• VS Code at /Users/hrishikeshrajwade/Downloads/Visual Studio Code.app/Contents
• Flutter extension version 3.60.0
Contributor guide
Research direction
Start by reproducing the Android startup trace with --trace-startup --profile and inspect startuptimeline.json around FlutterEngineMainEnter, DartVMInitializer, and the warm-up frame. Compare the timeline with DevTools' displayed events and determine whether the missing DartVMInitializer start event or the uninstrumented interval explains the reported gap. Done means the initialization interval can be identified or the missing instrumentation is clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- observability, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100