# getting-started


03/30/2023, 2:10 PM
Hello! I am currently writing my master’s thesis where I am comparing the performance of iOS applications developed in Kotlin Multiplatform Mobile vs native Swift applications. To be able to compare them I need to optimize both compilations so that they are as comparable as possible. I have managed to optimize the Kotlin/Native compilation by adding the compiler option
to the
list in the
file in the shared folder (execution time went from approx 1.4 to 0.33). Now, I have some questions: 1. What kinds of optimizations are made by adding
? (such as for instance “constant folding”, “dead code removal” etc.) 2. Are there other optimizations that I can apply? I would appreciate any input or suggestions that you have as I struggle to find documentation or information on this. If you know any good resources, let me know! Thanks!


03/30/2023, 10:02 PM
Yeah, the kotlin compiler and kotlin native lacks documentation. One option: You could always look into the sources: For example, follow this line/definition. So yeah, constant folding is done. Another option, you could create an issue or better ask in #kotlin-native And keep in mind, after Kotlinc LLVM is called. Swift uses llvm too. So you should also notice the different llvm configs, and its versions. In theory, you should be able to compare the different llvm bitcode, the "input" to llvm, comparing the equivalent kotlin code with Swift. Another important thing: The memory model! The newer versions of Kotlin uses a GC memory model, while Swift uses ARC..


03/31/2023, 5:45 AM
Thank you! I did not see that there was a kotlin-native channel, will ask there too.