Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B buck
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 201
    • Issues 201
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • buck
  • Merge requests
  • !2469

Improve Swift build performance by avoiding unnecessary recompilation of Swift modules

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/xianwen/swift-incremental-build into master Jun 02, 2020
  • Overview 25
  • Commits 1
  • Pipelines 0
  • Changes 3

Created by: xianwen

TL;DR;

Update SwiftCompile to support SupportsInputBasedRuleKey interface, so that we could avoid unnecessary Swift module recompilation if its input Swift modules' .swiftmodule artifacts weren't changed.

Details

Suppose Swift moduleA depends on Swift moduleB.

The current behavior of Buck is that whenever you touch the source code of moduleB, moduleA will always be rebuilt, even if you didn't change the public interface of moduleB. This has a heavy cost and unnecessarily slows incremental builds down a lot.

This PR avoids the recompilation of moduleA in this given example by evaluating the md5sum of moduleB.swiftmodule, which is a binary superset of moduleB's all public interfaces. As long as a Swift module's .swiftmodule remains unchanged after its compilation, it is safe to not recompile its dependents.

I verified this PR is working in an Airbnb demo project Buck Sample here: https://github.com/airbnb/BuckSample/pull/132

By applying this PR internally at the Airbnb's fork of Buck here, https://github.com/airbnb/buck/pull/23/, our p50 of local iOS build time has reduced more than 30% in the last 2 weeks.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/xianwen/swift-incremental-build