macOS JVM Stuttering/Lags
- Dominant language
- Kotlin
- Stars
- 3k
- Forks
- 148
- Avg merge
- 13h 44m
- Merged PRs (30d)
- 1
Description
**KorGE version:** 2.1.1.6
**IntelliJ Version:** 2021.1.2
**Operating System:** macOS Big Sur Beta 11.5 - Intel CPU
I found that using JVM on macOS is causing stuttering/lagging with a basic cube moving around the screen. I've tested the same code on a Windows machine and everything works fine without any performance issues. Native and JS on macOS works fine and has zero performance issues, no lagging or stuttering which to me sounds like a macOS JVM performance probem.
Please see two videos from two different operating systems:
**[macOS](https://streamable.com/4idstn)**
**[Windows](https://streamable.com/vfzay0)**
As you can see on the videos, macOS is clearly stuttering with its movements while Windows is smooth 60FPS. Both look exactly the same even on recording and both also were recorded at 60FPS.
A very simple and primitive code I've used (I'm still a beginner to Kotlin/KorGE so bear with me.)
```kotlin
import com.soywiz.klock.milliseconds
import com.soywiz.korev.Key
import com.soywiz.korge.*
import com.soywiz.korge.view.*
import com.soywiz.korim.color.Colors
suspend fun main() = Korge(width = 512, height = 512, bgcolor = Colors["#2b2b2b"]) {
var boxy = solidRect(20,20, Colors.WHITE) {
position(256,256)
}
val input = views.input.keys
addChild(boxy)
boxy.addUpdater { time ->
val scale = time / 16.milliseconds
if (input[Key.LEFT]) x -= 3 * scale
if (input[Key.RIGHT]) x += 3 * scale
if (input[Key.UP]) y -= 3 * scale
if (input[Key.DOWN]) y += 3 * scale
}
}
Contributor guide
No contributing guide indexed for this repository
Research direction
Use the supplied Kotlin main entry point and basic cube reproducer as the first test, running it on the macOS JVM and comparing it with the reported Windows, native, and JS results. Trace the JVM rendering and update path from this sample; done means the cause is identified and the sample no longer exhibits the reported stuttering on macOS.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin, macos
- Domain
- desktop, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100