-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Very long compile time in large functions #215
Comments
Just wanted to chime in and say I am seeing this also. Currently a huge chunk of my build time is spent in these methods. I use the same tool as @samuelbeek posted. |
Both @MPiccinato and I dove into this and it is slowest when combining assignment and comparison operators. So for instance in a line like this one Anything we can do about that? |
I've added a couple of functions to my project to replace the == operator in cartography. You can find them in this Gist (WIP). It slimmed down the compile time of most Cartography blocks to 30% of the original time, which are pretty impressive results. |
I'm seeing the same things. Compile times over 100ms for not overly complex stuff Noticed one thing:
vs
This shaved off 200ms from originally >300ms. Still not really great having them over 100ms but at lot better at least. |
Is it to do with type inference? Swift is still a dog with that |
I've come into this as well (having big compile times on all Cartography closures). Looks like function overload could be the cause ( Does someone think there's a good way of fixing it? Or should we just keep relying on thinking it'll get better on a future Xcode release? |
I'm not sure it's the |
For what it's worth, anecdotally this seems to be a lot faster for me nowadays. |
@ianyh What did you change to reduce the compile time? |
Nothing. Swift compiler changes seem to have improved the type inference, which is what I think was slowing it down. |
Again, this is somewhat anecdotal. I haven't done any thorough timing tests. |
Building my app after cleaning is more than 11min... Xcode 8.3.2 ? |
Yes. It's possible I've just adjusted to my capricious robot overlords. I'll do some more thorough timing when I get a chance. |
Any update on this issue? We have some large (30 line) constrain functions that are giving us 600-700ms compile time. Is there anything we can do to decrease this? Btw it looks like it hasn't been mentioned before but you can measure the compile time of functions by following this guide here: https://www.jessesquires.com/blog/measuring-compile-times-xcode9/?utm_campaign=iOS%2BDev%2BWeekly&utm_medium=web&utm_source=iOS_Dev_Weekly_Issue_320 |
No updates, so you're welcome to take a look 👍 |
Hi, reading this thread it seems very similar to an issue we had on Stevia a while ago, due to operator overloading, we're all in the same boat ! |
I've added PR #293 as a potential solution. At Instacart we use Cartography heavily in one of applications and after migrating most of the code over to the new syntax the (clean) build time has been halved (from about 5 min to 2.5). All of our view constraint setups run in a few milliseconds where most were in the hundreds, if not thousands (worst case we had was 8800ms for one view). Strongly recommend the core team looks over this issue and applies some (maybe not my) solution. Feel free to use Thanks for a great library! |
It's difficult to find a satisfying solution without compromising the API. - label.baseline == otherLabel.firstBaseline + 10
+ let _:NSLayoutConstraint = label.baseline == otherLabel.firstBaseline + 10 as Expression<Edge> Less readable but improves compile times considerably. If it looks like the compiler performance problems won't be addressed (soonish) then a new API is probably in order. |
Hi, using this tool, I found that a some of the larger
constrain
functions in my app take a really long time to compile, in the 500ms spectrum on a pretty new MacBook Pro. Do you know if there's specific things that cause these longer compile times? I'd love to contribute some improvements and can do some tests myself, but if you happen to know where to look that'd be great.Thanks
The text was updated successfully, but these errors were encountered: