Posts

Post not yet marked as solved
1 Replies
174 Views
Hello, I have been developing a Swift package and importing it into other projects. When I import the package into a project and check the execution times of some package functions, I notice slow execution times. However, if I add the source files of the package directly into the project and run the same test functions, then the whole module optimization achieves amazing run times, which are tens of times faster. The package heavily uses generics, and the project is a command line project. I would like to ask if there is a proper way to edit project build settings and the package.swift so that the compiler performs cross-module optimization and achieves hopefully similar run times with the whole-module optimization case. Some previous posts indicated the use of -cross-module-optimization and SWIFT_CROSS_MODULE_OPTIMIZATION, and I tried them in numerous places in the project target build settings with no success. I also added this Swift setting to the package.swift: swiftSettings: [ .unsafeFlags(["-cross-module-optimization"], .when(configuration: .release)) ] but it didn't lead to faster run times. I appreciate any comments/help. Thanks.
Posted
by Ismet.
Last updated
.