diff --git a/app/androidApp/src/main/kotlin/com/example/aiapp/MessageBlocks.kt b/app/androidApp/src/main/kotlin/com/example/aiapp/MessageBlocks.kt index 4bc29a8..b1ea9d7 100644 --- a/app/androidApp/src/main/kotlin/com/example/aiapp/MessageBlocks.kt +++ b/app/androidApp/src/main/kotlin/com/example/aiapp/MessageBlocks.kt @@ -101,7 +101,9 @@ fun BlockedMarkdown(text: String, replies: ParsedReplies, modifier: Modifier = M "tallest drawn block px", offsets.height(index).toLong(), ) + val started = System.nanoTime() drawContent() + DebugStats.record("draw: one block", System.nanoTime() - started) } else { DebugStats.count("block skipped") } diff --git a/app/androidApp/src/main/kotlin/com/example/aiapp/TranscriptScroll.kt b/app/androidApp/src/main/kotlin/com/example/aiapp/TranscriptScroll.kt index ce8f081..76fcf92 100644 --- a/app/androidApp/src/main/kotlin/com/example/aiapp/TranscriptScroll.kt +++ b/app/androidApp/src/main/kotlin/com/example/aiapp/TranscriptScroll.kt @@ -366,6 +366,11 @@ fun TranscriptColumn( // One gesture detector for the whole list; see [TranscriptScroll.tappedHigh]. On the // initial pass and consuming nothing, so every control inside still gets the gesture // exactly as it would have. + .drawWithContent { + val started = System.nanoTime() + drawContent() + DebugStats.record("draw: the whole transcript", System.nanoTime() - started) + } .pointerInput(Unit) { awaitEachGesture { state.touched( @@ -387,7 +392,18 @@ fun TranscriptColumn( // Composed and measured whether or not it is drawn; see // [TranscriptScroll.onScreen]. The check reads the scroll position from // the draw phase, so moving the list invalidates drawing and nothing else. - .drawWithContent { if (state.onScreen(item.startSeq)) drawContent() } + // Timed as well as counted. Counting said what was skipped, and the + // answer stopped being useful the moment almost everything was: 4,090 rows + // drawn against 94,815 skipped, and drawing still took 30.9ms. A timer + // says which of the two remaining answers is true -- that the little being + // drawn is somehow expensive, or that the time is not in the transcript at + // all and every count here is beside the point. + .drawWithContent { + if (!state.onScreen(item.startSeq)) return@drawWithContent + val started = System.nanoTime() + drawContent() + DebugStats.record("draw: one row", System.nanoTime() - started) + } ) { // So a block of a long reply can ask the same question the row just answered, // about its own part of it; see [RowWindow].