This commit is contained in:
ponzischeme89
2026-08-24 13:13:44 +12:00
parent a6bd655786
commit 4f95767e2f
7 changed files with 47665 additions and 19 deletions
@@ -39,13 +39,33 @@ class BaselineProfileGenerator {
browseHome()
}
/**
* Walks the launcher the way a viewer does, and walks it *vertically*.
*
* Two Down presses were not enough. Moving between shelves is the most expensive thing
* the launcher does — a row is composed as it scrolls in, the focus request is posted
* and consumed, and the hero catches up behind it — and none of that was in the profile,
* so on a television it ran interpreted. Measured on a Chromecast with Google TV, that
* was the difference between a 72ms and a 10ms recomposition at the 90th percentile.
*
* The walk goes down far enough to compose shelves beyond the first viewport and back up
* again, because entering a row from below is a different path from entering it from
* above, and both are on the D-pad.
*/
private fun MacrobenchmarkScope.browseHome() {
repeat(4) { device.pressKeyCode(KeyEvent.KEYCODE_DPAD_RIGHT) }
device.waitForIdle()
device.pressKeyCode(KeyEvent.KEYCODE_DPAD_DOWN)
repeat(6) {
device.pressKeyCode(KeyEvent.KEYCODE_DPAD_DOWN)
device.waitForIdle()
}
// Travelling a shelf is what pulls in the card, artwork and metadata composables
// for a row that was composed by a vertical move rather than by the first frame.
repeat(3) { device.pressKeyCode(KeyEvent.KEYCODE_DPAD_RIGHT) }
device.waitForIdle()
device.pressKeyCode(KeyEvent.KEYCODE_DPAD_DOWN)
device.waitForIdle()
repeat(6) {
device.pressKeyCode(KeyEvent.KEYCODE_DPAD_UP)
device.waitForIdle()
}
}
}