RobertGummesson / BuildTimeAnalyzer-for-Xcode

Build Time Analyzer for Swift
MIT License
4.3k stars 260 forks source link

support timing expression type checking in addition to function checking #61

Closed neilt closed 7 years ago

neilt commented 7 years ago

Is it possible to support -Xfrontend -debug-time-expression-type-checking as explained here: Swift Users Mail List

RobertGummesson commented 7 years ago

I just tried -Xfrontend -debug-time-expression-type-checking and my project won't even compile with this in place. I wonder in what version this was introduced (I am on Xcode 8.2.1 and not on the beta).

RobertGummesson commented 7 years ago

Ok, this appears to be a beta feature. "That was released prior to the addition of the new option. Recent snapshot builds from https://swift.org/download/#snapshots https://swift.org/download/#snapshots as well as the more recent Xcode 8.3 betas have it."

RobertGummesson commented 7 years ago

Ok after I've downloaded the beta, I see what it's doing. That looks interesting and something I think the analyzer should support. Now to the tricky bit, to find and set aside the time to implement it. ;)

neilt commented 7 years ago

Excellent.

Sorry I should have mentioned that it was only in the beta versions. Either Xcode Beta 5 is nearing GM release or Apple messed up the build, because when expanded it is named Xcode.app, not Xcode-Beta.app.

RobertGummesson commented 7 years ago

@neilt - This was a really nice find. Got some surprising results after the analyzer parsed it. I need to add some info to the instructions screen and communicate the change before making a new release. In the meantime, if you want to add the new flag, you can try it out using this branch.

Note that the function info (the column to the right) is not available when using this flag (which is why it failed to parse the result earlier).

neilt commented 7 years ago

The new version works pretty well. Able to knock about 1/3 off my compile times today. Looking forward to the final version.

I did notice that code changes to reduce expression compile times were not independent. When one expression was reduced, another near by popped up and took its place with about the same compile times. But fixing them eventually had a significant impact. This is not, of course, related to your changes or code. Its just an observation.

RobertGummesson commented 7 years ago

Yes, I noticed the same thing. I sent off an email with a couple of questions to the Apple dev who added it to Xcode earlier. Would like to build a better understanding of why that happened before merging this to master. In my case it was just a simple String property. Nothing complex at all.

RobertGummesson commented 7 years ago

For anyone following this - I expect more information about this next week so will park the work on this branch until then...

RobertGummesson commented 7 years ago

Merged to master. Still awaiting more info about this option but don't see any harm of merging this in in the meantime.