<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">If you can collect an instruments profile of the frontend running one of the particularly-slow files, it might help localize the subsystem of the typechecker; aside from that, I'm currently putting some new counters and timers in the frontend, so am likely to have slightly more-constructive news in the next little while, but don't have that work done just yet.</div><div class=""><br class=""></div><div class="">For collecting an instruments profile, try something like:</div><div class=""><br class=""></div><div class=""> $ SWIFTBIN=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift</div><div class=""> $ instruments -t 'Time Profiler' $SWIFTBIN -frontend -parse somefile.swift</div><div class=""> $ open instrumentscli0.trace</div><div class=""><br class=""></div><div class="">Then expand all (option-click the triangle next to 'swift' in the call-tree), select-all, copy and paste the complete call-tree into a text file and attach it here, that might give a bit of insight. On my local copy of instruments one also has to toggle the "separate by state" box of the details pane to get the full call-tree to expand, not sure why; might just be a transient bug.</div><div class=""><br class=""></div><div class="">-Graydon</div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On Oct 5, 2016, at 3:37 PM, Ben Asher 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" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">I just tried with both Xcode 8.1 beta 2 and Xcode 8.0, and 8.1b2 seems maybe 15s faster (to build our main huge target): 7m28s compared to 7m43s. It's some improvement, but I'm not exactly sure what kind of improvement was expected.<div class=""><br class=""></div><div class="">Is there any profiling/tracing you all would recommend to help find problem areas? I don't mind building from Swift master, using someone's preferred profiling tools, etc. I'm not really sure where to start.<br class=""><div class=""><br class=""></div><div class="">Ben</div></div></div><div class="gmail_extra" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""><div class="gmail_quote">On Wed, Oct 5, 2016 at 1:05 PM, Ben Asher<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:benasher44@gmail.com" target="_blank" class="">benasher44@gmail.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr" class="">Apologies for not starting off with system info: macOS Sierra (10.12.0), Xcode 8.0 (from the App Store).<div class=""><br class=""></div><div class="">I'll try with Xcode 8.1 beta this afternoon and report back. Ill also open a ticket for improving -debug-time-function-bodies if I can confirm anything.</div><div class=""><br class=""></div><div class="">Thanks!</div><div class=""><br class=""></div><div class="">Ben</div></div><div class="gmail_extra"><div class=""><div class="h5"><br class=""><div class="gmail_quote">On Wed, Oct 5, 2016 at 1:00 PM, Mark Lacey<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:mark.lacey@apple.com" target="_blank" class="">mark.lacey@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Oct 4, 2016, at 2:38 PM, Ben Asher via swift-dev <<a href="mailto:swift-dev@swift.org" target="_blank" class="">swift-dev@swift.org</a>> wrote:</div><br class="m_2386091958347163566m_1098956126652972838Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hello! I work with a large project (~900 .swift files and more .m files). We have a nightly job that compiles the app and calls out function bodies (using -debug-time-function-bo<wbr class="">dies) that are slower than 100ms to compile. Since upgrading to Swift 3, the number of trouble function bodies has one from > 150 to < 20, so we're really happy about that! The only issue though is that build time overall increased by ~1 min (amount of time to build all targets before automatically merging to master in our integration build).</div></div></blockquote><div class=""><br class=""></div></span>Is this using a particular release of Xcode (8.0 or an 8.1 beta?), or with one of the toolchain builds from<span class="Apple-converted-space"> </span><a href="http://swift.org/" target="_blank" class="">swift.org</a>?</div><div class=""><br class=""></div><div class="">Xcode 8.1 beta 2 includes some type checker performance improvements which might have an impact here.</div><div class=""><span class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">To dig into this further, we've started a new nightly job that builds the app using the -debug-time-compilation flag, and using that we've found that some files take as long as 2-3 seconds to compile. But, there's no targeted output to help us get this down via the -debug-time-function-bodies flag (i.e. no function bodies that we can refactor to get compile times much faster).</div></div></div></blockquote><div class=""><br class=""></div></span><div class="">One thing to look out for here is that I believe there are some cases where -debug-time-function-bodies isn’t reporting type checking time. From my (potentially faulty) recollection, things like let bindings with literals or closures on the right hand side do not show up in the -debug-time-function-bodies output, and depending on the specifics of the expression these can sometimes take a long time to type check. When these appear within the body of another type declaration they can end up getting type checked multiple times during a full project build, and that time can add up.</div><div class=""><br class=""></div><div class="">I don’t believe there is a bug open for improving -debug-time-function-bodies to help diagnose this, but opening a bug would be appreciated if you can confirm that this is the case, and of course patches to fix it are definitely welcome as well.</div><span class="m_2386091958347163566HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div><div class="">Mark</div><br class=""></font></span><blockquote type="cite" class=""><div class=""><span class=""><div dir="ltr" class=""><div class="">We can see that most of the time is spent in "Type checking / Semantic analysis" for these problem files, but we don't currently have any way of knowing what that means. It feels like we've exhausted the available options at this point (unless there are other flags I'm missing) in terms of existing actionable debugging/profiling/reporting, so now our question is this: what kind of reports would Swift maintainers be interested in seeing in terms of output from profiling tools, etc. to help debug/diagnose these slow compile issues? We're willing to devote time to tooling to help generate such reports and file bugs.</div><div class=""><br class=""></div><div class="">Thanks!<br clear="all" class=""><div class=""><br class=""></div><div class="m_2386091958347163566m_1098956126652972838gmail_signature"><div dir="ltr" class="">Ben</div></div></div></div></span><span class="">______________________________<wbr class="">_________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" target="_blank" class="">swift-dev@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-dev" target="_blank" class="">https://lists.swift.org/mailma<wbr class="">n/listinfo/swift-dev</a><br class=""></span></div></blockquote></div><br class=""></div></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div></div></div><span class="HOEnZb"><font color="#888888" class="">--<span class="Apple-converted-space"> </span><br class=""><div class="m_2386091958347163566gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class="">-Ben</div></div></font></span></div></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class="">-Ben</div></div></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-dev mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:swift-dev@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">swift-dev@swift.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-dev" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-dev</a></div></blockquote></div><br class=""></body></html>