-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
TextField cursor animation uses a lot of CPU #4225
Comments
to reproduce:
then click inside the green textfield to focus it, and you see the blinking cursor. |
Could you provide a smaller reproducer? |
whats the problem with this one? |
A small/minimal reproducer demonstrates the bug. A project
|
i will remove as much as i can. but as you say its probably a combination of things. |
i removed as much as possible from that branch. |
Can you post the code here then? |
you will still need some project and gradle files to run it. |
|
On my computer (M1 Ultra) this app goes from ~2% to ~20% CPU when focusing the text field.
This doesn't seem reasonable, indeed. |
The proximal reason for this is that the cursor blinking is implemented as a regular animation, which causes The above shouldn't be spiking the CPU so high, however, and according to @igordmn, on Windows, it doesn't. So it seems we have a problem in Skiko on Linux and/or macOS. For example, this skiko code also causes an unreasonably high CPU utilization:
|
any progress on the fix? is there an issue or PR to watch? |
There will be a fix, but not in 1.6.0. I'll post an update here. |
after it is merged, how can i get it in my app? |
A while ago I noticed a similar issue but I cannot remember if I ever reported it. val MODIFIER = Modifier.pointerHoverIcon(PointerIcon(Cursor(Cursor.WAIT_CURSOR)))
fun main() {
application {
Window(visible = true, onCloseRequest = {
exitApplication()
}) {
Column(
modifier = MODIFIER
) {
Text("Pointer Cached")
}
}
}
} The issue is that the spinning cursor stutters and sometimes stops for up to a second before spinning again. I am on MacOS with the latest compose version |
We have regular dev releases. |
this fixes: JetBrains/compose-multiplatform#4225 TextField cursor animation uses a lot of CPU and autofocus on text fields for entering a message again.
this fixes: JetBrains/compose-multiplatform#4225 TextField cursor animation uses a lot of CPU and autofocus on text fields for entering a message again.
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks. |
Describe the bug
i have a text input in my app, when i click on it to focus and enter text, cpu usage goes to 100%
as soon as i click somewhere else to shift focus, cpu goes back to normal again
Affected platforms
Versions
To Reproduce
Steps and/or the code snippet to reproduce the behavior:
Expected behavior
set focus on the textfield and not use 100% cpu
The text was updated successfully, but these errors were encountered: