From 71e0b05336fd732eaaf8a8e53e5a9fe453823b03 Mon Sep 17 00:00:00 2001 From: Nikita Lipsky Date: Thu, 19 Dec 2024 19:23:19 +0200 Subject: [PATCH] Fix 20s first frame rendering on LazyList benchmark (#5192) Fixes [CMP-7195](https://youtrack.jetbrains.com/issue/CMP-7195/Strange-behaviour-of-AnimatedVisibility-and-LazyList-benchmarks) --- .../benchmarks/src/commonMain/kotlin/MeasureComposable.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/benchmarks/multiplatform/benchmarks/src/commonMain/kotlin/MeasureComposable.kt b/benchmarks/multiplatform/benchmarks/src/commonMain/kotlin/MeasureComposable.kt index 409a8f772a..4bdaae5630 100644 --- a/benchmarks/multiplatform/benchmarks/src/commonMain/kotlin/MeasureComposable.kt +++ b/benchmarks/multiplatform/benchmarks/src/commonMain/kotlin/MeasureComposable.kt @@ -56,8 +56,11 @@ suspend fun measureComposable( // warmup repeat(warmupCount) { scene.render(canvas, it * nanosPerFrame) + surface.flushAndSubmit(false) } + graphicsContext?.awaitGPUCompletion() + runGC() var renderTime = Duration.ZERO @@ -65,8 +68,10 @@ suspend fun measureComposable( renderTime = measureTime { repeat(frameCount) { scene.render(canvas, it * nanosPerFrame) + surface.flushAndSubmit(false) } } + graphicsContext?.awaitGPUCompletion() } val frames = MutableList(frameCount) {