RobertGummesson / BuildTimeAnalyzer-for-Xcode

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

Show cumulative compile time #27

Closed eaigner closed 8 years ago

eaigner commented 8 years ago

This change groups all identical lines together and shows their summed up build time. It also removes the 20 results limit and only logs files whose cumulative compile time exceeds 10ms. Also if a single line in the same source file produces multiple results, but with a different column, they are summed up too.

This unfortunately also disables the live update (for now).

Closes #26

RobertGummesson commented 8 years ago

Nice one. Let me try it out later. I can sort out the live updates so don't worry about that.

eaigner commented 8 years ago

The problem with the live updates is that the results can only be generated after all values are known (since the compile times are accumulated)

RobertGummesson commented 8 years ago

No problem. I know how to work around that. 🙂

RobertGummesson commented 8 years ago

Hmmm... I just did a test and the values look a bit odd. For this

let indicatorSize = CGSize(width: 20, height: 20)
lazy private var labelOffset: CGPoint = CGPoint(x: -self.indicatorSize.width * 0.15, y: -20)

I got a build time of 820ms for the labelOffset getter and it's only referenced twice. If I stick the same two lines of code in a new project, the labelOffset is built in nearly 0.0ms.

However odd that may seem, it does seem that compiler actually does spend the time on this:

16.8ms  CMGridView.swift:28:14  @objc get {}
9.3ms   CMGridView.swift:28:14  @objc get {}
11.5ms  CMGridView.swift:28:14  @objc get {}
10.3ms  CMGridView.swift:28:14  @objc get {}
9.8ms   CMGridView.swift:28:14  @objc get {}
8.8ms   CMGridView.swift:28:14  @objc get {}
18.6ms  CMGridView.swift:28:14  @objc get {}
9.0ms   CMGridView.swift:28:14  @objc get {}
12.4ms  CMGridView.swift:28:14  @objc get {}
10.2ms  CMGridView.swift:28:14  @objc get {}
...and so on.

When I have a moment, I'll try to make my fresh project behave this way too and measure the overall build time to verify that this is actual compiler time. ...which it does seem to be.

RobertGummesson commented 8 years ago

Could you please direct this pull request to the branch called "cumulative-compile-time" instead of master? Will fix the live update on there. Also noted an issue if all compile times are less than 10ms which I can fix.