Open jonahwilliams opened 1 year ago
@jonahwilliams The VM has a flag worker_thread_priority
which sets the thread priority of all threads started by the VM, would this be sufficient?
Priority is insufficent, we also need to adjust CPU affinity specifically for android due to the heterogeneous clock speeds.
Priority is insufficent, we also need to adjust CPU affinity specifically for android due to the heterogeneous clock speeds.
another flag similar to thread priority maybe called worker_cpu_affinity
which would set the CPU affinity for all threads started by the VM would be sufficient ?
If it accepted something like a cpu_set_t that might work. i'd need to check when we initialize the VM, we should make sure that we can determine the correct affinity before we need to set that flag.
@jonahwilliams did you get a chance to check if cpu_set_t would work ?
Sorry for not getting back to this. We should be able to correctly determine the affinity from almost anywhere, however the cpu_set_t structures are opaque/platform-dependent so I don't think they could be configured via CLI flag.
Running a debug/profile mode Flutter application can result in different performance characteristcs than release mode if the device is under any sort of strain. One particular issue on Android is that the Dart Profiler thread is running with very high priority and can occupy one of two fast cores on a Pixel 6.
Perfetto Link: https://ui.perfetto.dev/#!/?s=59bd3e3c6faba4cf102d9b9e09fe24074a78f0103a13c00c62de4ead405d135f
The Flutter engine already has mechanisms to set the thread priority and affinity on Android/Linux devices. This is a request for an API (some sort of callback?) the flutter engine can use to adjust the properties of this profiler thread(s).