So I've tried out the 1.9.20-BETA and tested it ou...
# kotlin-native
k
So I've tried out the 1.9.20-BETA and tested it out with a OpenGL framework (Raylib), while surprisingly the version did bring some nice improvements, I've experienced quite a lot of pause time and it does feel a bit weird... You can see it in the video quite clearly how the whole context freezes for few seconds and return and the FPS counter increases. Now that didn't happen in 1.9.10 so I'm unsure if its my code (C Interop is heavily wrapped around, but again, this did not happen in earlier version) and the way everything is wrapped around or is it because it's still beta ofc.
m
I don't have an exact explanation for this problem, however I think it is caused by the GC, which starts cleaning more importantly longer when there are more objects to remove. From the last change log I can see Native. Runtime. Memory •
KT-57773
Kotlin/Native: track memory in big chunks in the GC scheduler •
KT-55364
Implement custom allocator for Kotlin/Native •
KT-57772
Kotlin/Native: concurrently process weak references in GC •
KT-57771
Kotlin/Native: parallel mark in GC So maybe the
KT-57771
one?
k
Ah cool so it’s most likely the GC that’s causing it.
m
You can try to log the GC actions and put it here, see https://kotlinlang.org/docs/native-memory-manager.html#monitor-gc-performance
k
Yeah gonna have to try it out because using 1.9.20-Beta has weirdly enough destroyed the performance on my laptop with Linux but macOS performance was better so I’m gonna try it out on it later when I’m back home
👍 1
yikes that's a lot https://pastebin.com/XARmH7jw Now even on my Mac the performance got worse... No clue how, when it was fine this morning
m
Copy code
[INFO][gc][tid#11085][3.600s] Epoch #1: Time to pause #1: 0 microseconds.
[INFO][gc][tid#11085][3.600s] Epoch #1: Mutators pause time #1: 2620 microseconds.
[INFO][gc][tid#11085][3.600s] Epoch #1: Finished. Total GC epoch time is 66667 microseconds.
[INFO][gc][tid#11085][3.600s] Epoch #1: Finalization is done in 25 microseconds after epoch end.
Unfortunately, I'm not a GC expert, but one (or the sum?) of those times could indicate how long the application had to be completely stopped for the cleanup to take place. Which explains the chopping/pausing animation.
k
Yeah it's huge
Compared to 1.9.20-Beta this is 1.9.10: https://pastebin.com/syhgz3UU
A much smaller heap memory usage. Total GC epoch time is smaller, but mutators pause is a bit higher
o
FYI: better to retest after https://youtrack.jetbrains.com/issue/KT-61914/Kotlin-Native-massive-increase-in-memory-usage will be fixed - may be it will help 🙂
👍 2
k
Fingers crossed it will be fixed and pushed for new beta version!
Just tried 1.9.20-Beta2 and can say a massive improvement, the FPS is rather stable until you hit 36's, then you have the sudden FPS drops and backs up again. Long and often world pauses still persist though. But the massive mem allocs are gone.
🎉 4
A small comparison. 15k bunny entities (on my Mac Studio m2 max) allocated with 1.9.10 (but no world freezes) while in 1.9.20-Beta2 we got 21k bunny entities. That is a massive jump. However, if the world freezes that still happen often won’t be fixed it will be impossible to use it