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 characteristics of skiko AWT on Linux + OpenGL are not good #494

Closed
adorokhine opened this issue Feb 14, 2022 · 5 comments
Closed
Assignees

Comments

@adorokhine
Copy link

General advice for dealing with Swing UI (and UI in general) is to render into a backbuffer, then swap the buffers.

Before I switched to Skiko, I drew into a java.awt.Canvas which I could swap:
http://www.cokeandcode.com/info/tut2d.html

However, Skiko draws and renders everything on the UI thread:

  1. check(isEventDispatchThread()) { "Method should be called from AWT event dispatch thread" }

This problem is exacerbated by the fact that Skiko's default settings submit the next redraw request as soon as the old one finishes, so regardless of how fast drawing actually happens, swing's UI thread is constantly swamped with Skiko rendering:

Swing uses the UI thread for drawing its own UI and especially for handling input events. Skiko's behaviour of swamping the UI thread creates significant input event lag. Even though Skiko's rendering is faster than what I had before, the UI is much laggier because it takes a lot longer for the event thread to pick up the input events, so the program takes a long time to respond to input.

I would suggest the following fixes:

  1. Don't request redraw immediately after rendering. Use a rate limiter or let the client program drive Skiko with its own event loop.
  2. Perform rendering off the event thread, into a back buffer. This way, even if rendering is slow (which it sometimes is for large scenes and slow hardware), input is still handled quickly and the UI remains snappy.
@adorokhine
Copy link
Author

(Here's where it spends most of its time in the event thread:)

image

@olonho
Copy link
Contributor

olonho commented Feb 14, 2022

#351 may somewhat help here.

@olonho
Copy link
Contributor

olonho commented Feb 14, 2022

Also note that Skiko on different platforms and backends behaves differently, so it would be better to describe OS and drawing backend used.

@olonho olonho changed the title Performance characteristics of skiko are not good Performance characteristics of skiko AWT on Linux + OpenGL are not good Feb 14, 2022
@igordmn igordmn self-assigned this Feb 14, 2022
@adorokhine
Copy link
Author

Thanks! This is Skiko 0.7.7 on Linux OpenGL

@okushnikov
Copy link

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants