Profile mode

When we execute our Flutter application in default debug mode with the flutter run command, we cannot expect the same performance as the release mode. As we already know, Flutter executes in debug mode using the JIT Dart compiler as the app runs, unlike the release and profile modes, where the app code is pre-compiled using the AOT Dart compiler.

To make performance evaluations, we need to make sure the app is running at its maximum capability; that's why Flutter provides different execution methods: debug, profile, and release.

In profile mode, the application is compiled in a very similar way to release mode, and this is clearly understandable, as we need to know how the app will perform in real scenarios. The only overhead added to the app is the required ones to make the profiling enabled (that is, the Observatory can connect to the application process).

Another important aspect of profiling is the necessity of a physical device. Simulators and emulators do not reflect the real performance of real devices. As the hardware is different, app metrics can be influenced and the analysis might be correct.

To run an app in profile mode, we should add the --profile flag to the run command (remember, it's only available on real devices):

flutter run --profile

Running in this mode, we have all of the needed information to inspect the app performance in general. Another useful tool the profile mode enables is the performance overlay.

IDEs also offer profile mode through their particular interfaces, so when you see this mode in the chosen IDE, you know what it means.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.204.208