Hi everyone, I want to measure how long a Composable takes to render, this should include the 3 phases (Composition, Layout and Drawing), I am not sure how to know that the Drawing phase has completed,
Hi everyone, I need to measure how much time a Composable takes to render , this should include the 3 phases (Composition, Layout and Drawing), using
LaunchedEffect
seems to work, but is it guaranteed that it will be always called after the Drawing phase?
The doc on
LaunchedEffect
says it will launch a job when it enters the Composition (so it should work in the first phase, right?), this gave me the impression that it doesn’t wait until the Drawing phase, but in reality it actually does for some reason, but not sure if this is guaranteed in all cases.
@Composable fun Example() {
val startTimestamp = System.currentTimeMillis()
Text("Hi)
LaunchedEffect(Unit) {
val endTimestamp = System.currentTimeMillis()
reportTime(endTimestamp - startTimestamp)
}
}