Open RafaelAthosPrime opened 6 months ago
Check this one as well: https://github.com/JetBrains/compose-multiplatform/issues/3543
Any news? Same problem with the version 1.6.0
Implementing this in Compose/Skiko can help, but it is not a trivial task, so it isn't planned on the nearest versions.
I suggest to not use any animations/indications on low level machines, it might slightly help until we speed up the software renderer in Compose.
I suggest to not use any animations/indications on low level machines, it might slightly help until we speed up the software renderer in Compose.
I think maybe is also related with the ripple effect and the shadow (elevation) of the Button component and the Modifier.clickable
I made a custom button with a simple Box and the performance boost from 25FPS to 63FPS with the software renderer
val interactionSource = remember { MutableInteractionSource() }
val isPressed by interactionSource.collectIsPressedAsState()
val color = if (isPressed) MaterialTheme.colors.primary else MaterialTheme.colors.secondary
Box(Modifier.padding(8.dp).clickable(interactionSource = interactionSource, indication = null) {
text = "Hello, Desktop!"
}.background(color, shape = RoundedCornerShape(8.dp))) {
Text(text, color = MaterialTheme.colors.onPrimary, modifier = Modifier.padding(16.dp, 8.dp), fontSize = 12.sp, fontWeight = FontWeight.Medium)
}
I made some more tests with the software renderer, in a page of my application the FPS was 35 FPS and removing the clickables ripple didn't help, what really made the difference is after I add elevation = 0.dp of all the Card() component removing the shadow the FPS became around 58~60FPS
I made some more tests with the software renderer, in a page of my application the FPS was 35 FPS and removing the clickables ripple didn't help, what really made the difference is after I add elevation = 0.dp of all the Card() component removing the shadow the FPS became around 58~60FPS
Button with shadow 20 FPS
Button(onClick = {
text = "Hello, Desktop!"
}, modifier = Modifier.padding(8.dp)) {
Text(text)
}
Button without shadow 63 FPS
Button(onClick = {
text = "Hello, Desktop!"
}, modifier = Modifier.padding(8.dp), elevation = ButtonDefaults.elevation(0.dp,0.dp,0.dp,0.dp,0.dp)) {
Text(text)
}
Based on my first example the FPS drops on every new window opened, is there any way to improve that?
Based on my first example the FPS drops on every new window opened, is there any way to improve that?
It may be because of the FPS counter itself. Try to hide it in background windows:
if (LocalWindowInfo.current.isWindowFocused) {
FPSCounter()
}
When you add an FPS counter, it requests redrawing of the whole window each frame.
My app is suffering from the same issue. It's a video player and one of the most important features is to display some moving text across the screen, hence I can not disable animations (and 60 FPS is very important here). The app is completely not usable now :(
Is there a workaround like somehow use GPU acceleration? The app currently uses 150% CPU with 0% GPU.
Is there a workaround like somehow use GPU acceleration?
Compose uses GPU acceleration by default. Software renderer is only used as a fallback (also might be set via parameters). If it's a question about video player, please ask the question in the issue tracker of the library that you use.
Compose uses GPU acceleration by default. Software renderer is only used as a fallback
Though, it uses Software in VM's, on some old unsupported GPU's and in a case if something is broken in the system (system dll's/so's or drivers)
Compose uses GPU acceleration by default
@MatkovIvan However, even in a minimal project, Compose is not using GPU on my machine. CPU 44% with GPU 0% when scrolling the list.
println("renderApi: " + this.window.renderApi)
I'm having 0% GPU when running with IntelliJ as well, but with a packaged release distributable, the GPU acceleration is working fine @Him188
I'm having 0% GPU when running with IntelliJ as well, but with a packaged release distributable, the GPU acceleration is working fine @Him188
Thanks @MohamedRejeb ! runReleaseDistributable
worked for me, seeing up to 20% GPU usage
Describe the problem I have been having performance problems with some clients that use my desktop software on Windows using renderApi SOFTWARE_FAST, my clients do not have an integrated video card and are unable to use OPENGL, the FPS is around 10~20. The FPS drops even more on higher resolutions, for example 1920x1080. I'm very worried because I spend 2 years working everyday in my desktop project since the compose multiplatform was in 1.0 alpha![image](https://github.com/JetBrains/compose-multiplatform/assets/147651057/584ef52b-a333-47ef-b7c5-63a78fe86b55)
Affected platforms Select one of the platforms below:
Versions