4

I work on a large Xcode iOS project that takes about 20 minutes to fully compile from a clean state. I've disabled compiler optimization in the debug mode as well as dYSM so I believe this is the fastest that this is ever going to compile. Every time I git checkout another branch, even simple one file changes, Xcode has to recompile everything and it takes forever and slows me down. Is there anything I can do to disable that? Thanks!

Math is Hard
  • 896
  • 1
  • 12
  • 24
  • Disabling optimizations can increase compile time depending on the complexity of the source code. Have multiple repos with different branches checked out. Whenever you update the timestamps on a file, it's going to recompile. – xaxxon Sep 09 '16 at 23:56
  • Having multiple repos is what I'm currently doing. I removed the `-O` settings from the build settings as recommended here: https://labs.spotify.com/2013/11/04/shaving-off-time-from-the-ios-edit-build-test-cycle/ – Math is Hard Sep 09 '16 at 23:58
  • So it recompiles all files that has their timestamps updated? – Math is Hard Sep 09 '16 at 23:59
  • 1
    Have you tried using git worktrees instead of switching branches all the time? https://github.com/blog/2042-git-2-5-including-multiple-worktrees-and-triangular-workflows – almas Sep 10 '16 at 00:15
  • No I have not, but I will follow up on that. Thanks for the suggestion! – Math is Hard Sep 10 '16 at 00:21
  • Wow, @almas, I sure missed the memo on that one. Thanks for the link. – matt Sep 10 '16 at 00:23

1 Answers1

2

What I've observed about git checkout is that it resets the file-created / -modified date of the file to now. I think Xcode sees that this has changed and takes it as a signal that the file has changed behind its back.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • Do you mean it resets the file-created/modified of all the files in the local repo? Is there a way to disable that on the git side? – Math is Hard Sep 10 '16 at 00:03
  • @MathisHard http://stackoverflow.com/questions/2458042/restore-files-modification-time-in-git – matt Sep 10 '16 at 00:08
  • Here's an idea: you could manually check out from the other branch only those files that are different. So only they would have their dates reset and only they would recompile (if my theory is right about what Xcode is doing). – matt Sep 10 '16 at 00:11
  • Thanks for the link. That looks really helpful, I think I can follow up on it. The checking out certain files part could only really work for small branch differences but I can definitely keep that in mind. – Math is Hard Sep 10 '16 at 00:20
  • This might be worth filing an enhancement request with Apple. You've got a compelling use case; surely this comes up frequently with big projects! – matt Sep 10 '16 at 00:21