<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi, Sam. I don't think we currently have a good answer for this built into xcodebuild or xctool, and it's a reasonable idea. (Ideally all builds would be fast enough that it wouldn't matter! That's obviously not where we are.)</div><div class=""><br class=""></div><div class="">Since '-debug-time-function-bodies' is now public knowledge, I'll share another one of our debugging flags, '-driver-show-incremental'. You can add this to your "Other Swift Flags". The output isn't very detailed, though:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing Tree.swift (initial)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing AdventureScene.swift (initial)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing AdventureScene.swift because of dependencies discovered later</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing AppDelegate.swift because of dependencies discovered later</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing ChaseArtificialIntelligence.swift because of dependencies discovered later</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing Character.swift because of dependencies discovered later</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing SpawnArtificialIntelligence.swift because of dependencies discovered later</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing Goblin.swift because of dependencies discovered later</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing Cave.swift because of dependencies discovered later</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing AdventureSceneOSXEvents.swift because of dependencies discovered later</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing HeroCharacter.swift because of dependencies discovered later</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing EnemyCharacter.swift because of dependencies discovered later</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing Boss.swift because of dependencies discovered later</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing SharedAssetManagement.swift because of dependencies discovered later</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing Warrior.swift because of dependencies discovered later</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing Archer.swift because of dependencies discovered later</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing Player.swift because of dependencies discovered later</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Queuing ArtificialIntelligence.swift because of dependencies discovered later</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class="">In this case, I took a version of the Adventure sample project and modified "Tree.swift"; that triggered recompilation of several other files. Unfortunately this view doesn't tell you how they're related, only which ones are actually getting rebuilt.</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class="">The next step (and moving into the territory of "working on Swift" rather than just "trying to figure out why it's repeating work") would be to look at the "swiftdeps" files stored in your DerivedData folder. These are currently just YAML files describing what Swift thinks the file depends on, as well as what will trigger rebuilding of other files. This is intended to be a conservative estimate, since <i class="">not</i> recompiling something would result in an invalid binary. (Unfortunately I say "intended" because there are known bugs; fortunately, archive builds are always clean builds anyway.)</div><div class=""><br class=""></div><div class="">There's a document in the Swift repo describing the logic behind Swift's dependency analysis: <a href="https://github.com/apple/swift/blob/master/docs/DependencyAnalysis.rst" class="">https://github.com/apple/swift/blob/master/docs/DependencyAnalysis.rst</a>. The one thing that's <i class="">not</i> in there is the notion of changes that don't affect other files at all. This is accomplished by computing a hash of all the tokens that <i class="">could</i> affect other files, and seeing if that hash has changed.</div><div class=""><br class=""></div><div class="">We definitely have room for improvement here.</div><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 31, 2016, at 11:24 , Samantha John via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div style="font-size:12.8px" class="">I have a large project (308 swift files, 441 objective c, 66k lines of code) where incremental builds can be extremely slow. I'm trying to do some profiling to figure out what type of things cause large scale recompiles. The problem is that I can't find a good way of telling which files get recompiled on an incremental build and which do not. It seems like files that are not recompiled still get listed in xcode, but the compiler just passes over them really fast. </div><div style="font-size:12.8px" class=""><span style="font-size:12.8px" class=""><br class=""></span></div><div style="font-size:12.8px" class=""><span style="font-size:12.8px" class="">Does anyone know if xctool or xcodebuild has this type of functionality? Or is there some other way to get this info?</span><br class=""></div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class="">Thank you,<br class="">Sam</div>
</div>
_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-dev<br class=""></div></blockquote></div><br class=""></body></html>