https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
t

tylerwilson

01/25/2022, 10:22 PM
Building my shared code as an XCFramework, which include targets iosArm32, iosArm64, iosX64, watchos, macos, takes 28 minutes! Any tips on ways to speed this up, if any? Do we expect the new front-end compiler might help here?
e

ephemient

01/25/2022, 10:25 PM
at a high level JB is working on improving K/N build times: https://youtrack.jetbrains.com/issue/KT-42294
but given that the different targets are compiled sequentially (https://youtrack.jetbrains.com/issue/KT-49385), you might have to try building for a smaller set of targets or building each target in a separate checkout (or machine) in parallel
t

Trevor Stone

01/25/2022, 10:39 PM
Have you turned on gradle cache and parallel builds?
Copy code
org.gradle.caching=true
org.gradle.parallel=true
in gradle.properties
e

ephemient

01/25/2022, 10:40 PM
Gradle can't run tasks in parallel within the same subproject (except when using configuration cache, which doesn't work with K/N, or when using workers, which K/N doesn't) so that won't help
t

tylerwilson

01/25/2022, 10:53 PM
i do sometimes comment out the targets i dont need when building for sim for debugging for example.
the parallel compile option seems like it would be a good solution, then link all when all done.
t

Trevor Stone

01/26/2022, 1:26 AM
from running a
./gradlew clean build
on my project (which is multi-module) on m1 max:
Copy code
org.gradle.caching=true
org.gradle.parallel=false
5m 30s
Copy code
org.gradle.caching=true
org.gradle.parallel=true
3m 43s I even ran the parallel build first in case there where any cache misses. Seems like it's worth giving a shot and seeing if you have any issues
e

ephemient

01/26/2022, 1:35 AM
ok sure, parallel does help with multiple modules (which are called projects in Gradle terminology). but within a project (or module in non-Gradle terminology) there is currently no parallelism, and the final framework link will be sequential per target
t

tylerwilson

01/26/2022, 1:13 PM
i added those flags and will see how it performs and let you know here. any little bit helps… thanks!
👀 1
3 Views