Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to find performance issue and fix in flutter

Tags:

flutter

I am using dart to develop a flutter(version 1.22.5) app, in my Android Studio(version 4.1.2), I found some frame render very slow(60 frame/s is good, now only 1/2) like this:

enter image description here

but the problem is, I do not know where make the render slow, how to find the performance issue? I know it slow, but where? what should I do to find it out? Is there any tips?

like image 816
Dolphin Avatar asked Jan 25 '21 05:01

Dolphin


People also ask

How do I fix errors in Flutter?

As stated in the error, "to fix this problem, create a new project by running flutter create -t app and then move the dart code, assets and pubspec. yaml to the new project." What you need to do is run the command line command `flutter create -t app ' (where is the location of the new project.

Why Flutter run taking too long?

When flutter run is taking forever to initialize gradle it is probably due to network problem. Else, you might need to download gradle manually and install it. Downloading gradle manually is advisable especially if you are connected to extremely slow network.


1 Answers

First you should apply Flutter performance best practices. After reading it you will probably optimize a few things.

Then you can check with Flutter performance profiling

The overlay should always be viewed in profile mode, since debug mode performance is intentionally sacrificed in exchange for expensive asserts that are intended to aid development, and thus the results are misleading.

When both graphs display red, start by diagnosing the UI thread.

In short it often comes mainly from non cached images, UI animation, etc

Also if GPU bar is high, it might be an algorithm issue (like the way you coded your raytracer is not optimized).

If you still have issue with performance you can try to run your app with SkSL warm-up

like image 90
Antonin GAVREL Avatar answered Nov 09 '22 04:11

Antonin GAVREL