Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance regression in Web in 1.6.0 #4412

Open
mahozad opened this issue Mar 2, 2024 · 5 comments
Open

Performance regression in Web in 1.6.0 #4412

mahozad opened this issue Mar 2, 2024 · 5 comments
Assignees
Labels
performance wait for reply Further information is requested web

Comments

@mahozad
Copy link
Contributor

mahozad commented Mar 2, 2024

Describe the problem
After updating to compose multiplatform 1.6.0 and adjusting the code:

- Window(title = "App") {
+ CanvasBasedWindow(
+     title = "App",
+     canvasElementId = "content",
+     applyDefaultStyles = false,
+     requestResize = { IntSize(width = 900, height = 800) }
+ ) {
Icon(
-   painterResource("m$n-logo.png"),
+   painterResource(DrawableResource("m$n-logo.png")),
- @OptIn(ExperimentalResourceApi::class)
+ @OptIn(InternalResourceApi::class)
suspend fun loadResource(path: String): ByteArray {
-    return resource(path).readBytes()
+    return readResourceBytes(path)
}
- <canvas id="ComposeTarget" width="900" height="800">Loading</canvas>
+ <canvas id="content"></canvas>

the web app performance is much worse than what it was in 1.5.10.

Affected platforms

  • Web (K/JS) - Canvas based API
  • Web (K/Wasm) - Maybe

Versions

  • Kotlin version: 1.9.22
  • Compose Multiplatform version: 1.6.0
  • OS: Windows 11
  • browser: chrome 122
  • JDK (for desktop issues): 17

Sample code
See the source code here.
And the live demo here.

Additional information
I am facing this on a system that has no dedicated graphics card (so it uses CPU to render?).

@eymar
Copy link
Collaborator

eymar commented Mar 12, 2024

Do you notice it only on a system without a dedicated GPU?

I see these errors in the console:
Screenshot 2024-03-12 at 11 10 19

I'm wondering if there were the same errors with 1.5.1x versions? I couldn't quickly find a working commit with 1.5.x in your repo to try it.

Btw, on my laptop I don't notice any performance issues with your app (the wave runs smoothly and Ui is responsive. But it has a GPU.

@eymar eymar added the wait for reply Further information is requested label Mar 12, 2024
@mahozad
Copy link
Contributor Author

mahozad commented Mar 17, 2024

Hello. The performance is bad on Chrome in an Android phone as well.

I too see those errors in the console.

On that system tried to run jsBrowserRun with cmp 1.5.12, 1.5.10, 1.5.0 and kotlin 1.9.22, 1.9.10 and all failed with the below error:
#4003:

kotlin.NotImplementedError: Generation of stubs for class org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl is not supported yet

On my system performance is not as bad but it was better in previous versions.

@eymar
Copy link
Collaborator

eymar commented Mar 18, 2024

Did you have the same app built with 1.5.1x versions? We would try to compare it with one built with 1.6.0.

The error:

kotlin.NotImplementedError: Generation of stubs for class org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl is not supported yet

It could mean there's a library incompatible with other libraries in your project. For example when you updated one library ("A") to a newer verision, but you also have another lib which depends on older version of "A".

@RafaelAthosPrime
Copy link

Maybe related to #4199 ?

@mahozad
Copy link
Contributor Author

mahozad commented Apr 2, 2024

Did you have the same app built with 1.5.1x versions? We would try to compare it with one built with 1.6.0.

Yes. But now cannot change the versions back to 1.5.1x and test the app again because of the error #4003.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance wait for reply Further information is requested web
Projects
None yet
Development

No branches or pull requests

4 participants