Open Bug 2003950 Opened 10 hours ago Updated 10 hours ago

Too much CPU time spent on Kotlin background threads during startup

Categories

(Firefox for Android :: Performance, enhancement)

All
Android
enhancement

Tracking

()

People

(Reporter: mstange, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

Profile: https://share.firefox.dev/44CAjN2

This is a startup profile focused on samples under kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run, i.e. all the Kotlin coroutine background work, during the first 1 second of Fenix startup.

I used the following simpleperf command:

adb shell su -c "/data/local/tmp/simpleperf record -g --duration 10 -f 4000 -e cpu-clock -a -o /data/local/tmp/su-perf.data"
Depends on: 2003953

Active background threads slow down Fenix startup because we have many more active threads than CPU cores during those first two seconds of startup. So the actual startup-blocking work is getting descheduled because background threads are stealing CPU core time slices.

You need to log in before you can comment on or make changes to this bug.