In my test, Kotlin Native takes 5~10 times longer ...
# compose-ios
g
In my test, Kotlin Native takes 5~10 times longer than Jvm when throwing and catching exceptions. I'm not sure if this is a reason why Compose lags on iOS. I also asked this question in kotlin-native. https://kotlinlang.slack.com/archives/C3SGXARS6/p1671198104761539
👀 1
n
Hi Gavin. Thank you for your report. Exception throwing is used for coroutines cancellation in Kotlin. Coroutines are widely used in Compose and their cancellation happens at #onForgotten calls for instance. So yes, the performance of throw/catch affects overall performance of Compose, we notice it analyzing execution profiles of compose applications. Though it is not the only reason of lags (https://github.com/JetBrains/compose-jb/issues/2283#issuecomment-1350809036). Frame drops (that are considered by users as lags) often happen because of GC pauses that we also see on execution profiles. Kotlin native team is aware of the most of the above problems and is working on them now (objects allocations, gc pauses, lock mechanism (that is also used by coroutines)).
g
@Nikita Lipsky Hi,thank you for your reply. XiongChen is my colleague. Recently, we are evaluating the performance of Compose on iOS to decide whether we should invest in Compose cross-platform next year. We very much hope to use Compose for cross-platform development, so we are also trying to find Compose performance issues on iOS. There is an interesting attempt, which may be used to verify whether Kotlin/Native GC has an impact on Compose. I found Compose to be significantly smoother with GC disabled. Disable GC I'm not sure if this information is helpful to you.
n
I found Compose to be significantly smoother with GC disabled
It is known issue. XiongChen also reported abnormal fling, we have reproduced it and now are finding the root cause of it.