-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
This tracker is for issues related to:
- Dart VM
I've been investigating the performance of the Layout operation in Flutter and I was surprised to find that a large amount of time spent in layout isn't actually occupied in CPU. I'm seeing that 50% of the time is spent in VM page faults.
For this example I'm just using the default Flutter project that is just simply a button. I'm running on an iPhone SE 2 (3 GB ram), with the Profile configuration. I've added signposts around the Layout event here.
What I'm seeing is that during the 25ms it takes to execute Layout, the thread is only active 16ms:

The total time spent in system calls for this time range is 128 µs, so it isn't because of system calls that the thread is not running.
If you look at the virtual memory usage though, a large percentage of time is spent in page faults (11.56ms):

Looking at the timeline, we see that the time the thread is inactive is correlated to the "File backed page in":

I don't know what the solution to this problem is, but given that this is the simplest Flutter project you can make on a device with a reasonable amount of RAM, we shouldn't be spending 50% of our time with page faults.