swiftlang / swift-sdk-generator

Generate Swift SDKs for cross-compilation
Apache License 2.0
182 stars 15 forks source link

generator: Cache the lld binary after extracting it from the LLVM archive #149

Closed euanh closed 1 week ago

euanh commented 2 weeks ago

Extracting lld from the llvm archive takes about 40s on my machine, and after the binary has been extracted a 5.5GB directory is left behind in the Artifacts directory.

This change uses tar filters to reduce the number of files unpacked from the archive and caches the resulting lld binary.

Excluding the time to download the archives, building an SDK from Debian packages before lld has been cached takes about 57s on an M3 MacBook Air. A subsequent build with lld cached takes about 17s.

The SDKs generated by the old and new methods are identical.

This PR adds CacheKey conformance to Array, as suggested by @yingguqing in #106. Adding this conformance to Range was not necessary in this case.

euanh commented 2 weeks ago

@swift-ci test

euanh commented 2 weeks ago

@swift-ci test

euanh commented 2 weeks ago

We won't need to download LLVM for Swift 6.0 and later because the open source toolchain package from swift.org already includes ld.lld.

euanh commented 2 weeks ago

@swift-ci test