Logs rendering time of sections of the post

This commit is contained in:
Vitor Pamplona
2023-06-27 12:26:57 -04:00
parent 50f2d18b61
commit c6ff514ba2
2 changed files with 49 additions and 31 deletions
@@ -195,6 +195,8 @@ import java.io.File
import java.math.BigDecimal
import java.net.URL
import java.util.Locale
import kotlin.time.ExperimentalTime
import kotlin.time.measureTimedValue
@OptIn(ExperimentalFoundationApi::class)
@Composable
@@ -571,6 +573,7 @@ private fun ClickableNote(
}
}
@OptIn(ExperimentalTime::class)
@Composable
fun InnerNoteWithReactions(
baseNote: Note,
@@ -599,24 +602,30 @@ fun InnerNoteWithReactions(
) {
if (notBoostedNorQuote) {
Column(WidthAuthorPictureModifier) {
AuthorAndRelayInformation(baseNote, accountViewModel, nav)
val (value, elapsed) = measureTimedValue {
AuthorAndRelayInformation(baseNote, accountViewModel, nav)
}
println("AAA Rendering Auth $elapsed - ${baseNote.event?.content()?.take(10)}")
}
Spacer(modifier = DoubleHorzSpacer)
}
Column(Modifier.fillMaxWidth()) {
val showSecondRow = baseNote.event !is RepostEvent && baseNote.event !is GenericRepostEvent && !isBoostedNote && !isQuotedNote
NoteBody(
baseNote = baseNote,
showAuthorPicture = isQuotedNote,
unPackReply = unPackReply,
makeItShort = makeItShort,
canPreview = canPreview,
showSecondRow = showSecondRow,
backgroundColor = backgroundColor,
accountViewModel = accountViewModel,
nav = nav
)
val (value, elapsed) = measureTimedValue {
NoteBody(
baseNote = baseNote,
showAuthorPicture = isQuotedNote,
unPackReply = unPackReply,
makeItShort = makeItShort,
canPreview = canPreview,
showSecondRow = showSecondRow,
backgroundColor = backgroundColor,
accountViewModel = accountViewModel,
nav = nav
)
}
println("AAA Rendering Body $elapsed - ${baseNote.event?.content()?.take(10)}")
}
}
@@ -629,12 +638,15 @@ fun InnerNoteWithReactions(
Spacer(modifier = DoubleVertSpacer)
}
} else {
ReactionsRow(
baseNote = baseNote,
showReactionDetail = notBoostedNorQuote,
accountViewModel = accountViewModel,
nav = nav
)
val (value, elapsed) = measureTimedValue {
ReactionsRow(
baseNote = baseNote,
showReactionDetail = notBoostedNorQuote,
accountViewModel = accountViewModel,
nav = nav
)
}
println("AAA Rendering Reac $elapsed - ${baseNote.event?.content()?.take(10)}")
}
}
@@ -35,6 +35,8 @@ import androidx.compose.ui.unit.dp
import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.ui.note.NoteCompose
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
import kotlin.time.ExperimentalTime
import kotlin.time.measureTimedValue
@Composable
fun RefresheableFeedView(
@@ -175,7 +177,7 @@ private fun WatchScrollToTop(
}
}
@OptIn(ExperimentalFoundationApi::class)
@OptIn(ExperimentalFoundationApi::class, ExperimentalTime::class)
@Composable
private fun FeedLoaded(
state: FeedState.Loaded,
@@ -196,20 +198,24 @@ private fun FeedLoaded(
state = listState
) {
itemsIndexed(state.feed.value, key = { _, item -> item.idHex }) { _, item ->
val defaultModifier = remember {
Modifier.fillMaxWidth().animateItemPlacement()
val (value, elapsed) = measureTimedValue {
val defaultModifier = remember {
Modifier.fillMaxWidth().animateItemPlacement()
}
Row(defaultModifier) {
NoteCompose(
item,
routeForLastRead = routeForLastRead,
modifier = baseModifier,
isBoostedNote = false,
accountViewModel = accountViewModel,
nav = nav
)
}
}
Row(defaultModifier) {
NoteCompose(
item,
routeForLastRead = routeForLastRead,
modifier = baseModifier,
isBoostedNote = false,
accountViewModel = accountViewModel,
nav = nav
)
}
println("AAA Rendering $elapsed - ${item.event?.content()?.take(10)}")
}
}
}