Feature profiling? #85
-
Is there a way to figure out how long each SKIE feature takes? I understand that it might not be possible if some features are done together in a single pass, in that case since I'm not a Gradle/Kotlin master, is there a way to measure how long the whole compiler plugin takes? The notion got prompted by the warning in default arguments feature here: https://skie.touchlab.co/features/default-arguments I'd like to know whether the impact is negligible or whether it's better to turn this useful feature off. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Unfortunately, measuring the overhead of individual SKIE features is not easy due to how the compilation process works. The best way is to try different settings and measure how the compilation time changes. You can use Gradle profiling (https://docs.gradle.org/current/userguide/inspect.html#profile_report) to see how long individual tasks take. SKIE modifies the Kotlin While profiling the compilation, do not forget that the compiler is a JVM process and therefore utilizes JIT. So, benchmarking the compilation correctly can be tricky. To get reasonable results, you need to run the compilation multiple times (for each test). Additionally, the build process utilizes multiple caching and incremental compilation features, which can cause problems. The best way to get around all of them is to create a single public Kotlin function in the module where you apply SKIE and change its name between each build. As for the default arguments, the overhead is proportional to the number of exported functions with default arguments. Therefore, enabling default arguments project-wide might not be noticeable for some projects but can increase the compilation time by 2x (or much more) for others. This is why we recommend selectively enabling them only for functions that you want to use from Swift. |
Beta Was this translation helpful? Give feedback.
Unfortunately, measuring the overhead of individual SKIE features is not easy due to how the compilation process works. The best way is to try different settings and measure how the compilation time changes.
You can use Gradle profiling (https://docs.gradle.org/current/userguide/inspect.html#profile_report) to see how long individual tasks take.
SKIE modifies the Kotlin
link
task, so it's sufficient to benchmark only this task. The exact task name depends on the project configuration and target architecture, for example:linkDebugFrameworkMacosArm64
. It's also possible to identify the task by looking at how long each task took to execute because the link task usually takes a long time.Wh…