-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Split build.cc -- new version of #3098 #4114
Conversation
If this is wanted, I hope we can merge it quickly, because it will bit-rot very fast :). |
The other issues are that it breaks history (which I do actually use), invalidates existing PRs (e.g. #3600, which BTW moves |
So git has recently been horrendous with conflicts for me with this, I'll admit. I ended up manually computing a diff, manually partitioning the hunks based one what new file they changes, and apply thing to fix conflicts. The modified patches at least applied cleanly, but that still is a rather bad process. Still, I think we should do this.
In particular, there are some big scheduler changes we'll need/want to do in the short term I rather do after this:
Hope this helps motivate this reactor :). |
It's actually a permanent cost: the history becomes permanently polluted. It's too bad git isn't better at following history across these kinds of refactors... Although apparently there is a very hacky way: https://devblogs.microsoft.com/oldnewthing/20190916-00/?p=102892 I'm not sure it's really worth it though. Incremental build times probably won't go down by much (since build/derivation-goal.cc is still huge) and non-incremental build times will go up. |
I'm more than happy to redo this with that trick. [FWIW, it doesn't even feel "very hacky" to me. The underlying issue is git only knows states not patches, computing patches as needed. In those circumstances, it may well be better to hand-hold git with a careful history than increase the complexity of the diff calculation, as one would pay for the latter with every computed diff. There are patch-theory-oriented version control systems like Darcs and https://pijul.org/ that solve this better by making the patch rather than state authoritative, but I don't think you are proposing that we switch to one of those at this time :).]
Well to me the build times is not main point for this. Rather, it's structuring the code better so the subsequent refactors are easier to understand and maintain. If we were to do all those changes in the single (Lastly, didn't you experiment with a way to do unity builds? We can always do that in non-incremental builds and never get a performance downside from splitting |
There is also the Regarding the merge commits, is there a reason for them? Rebasing patches is based on the "patch-theory-oriented" view and I have found it much easier to resolve conflicts when working with patches. And of course the commit history looks cleaner when rebasing instead of merging. |
… 'build-6', 'build-7' and 'build-8' into split_build_cc
a56e2ba
to
8cc510f
Compare
OK I did the Raymond Chen method for now, but I have the old stuff at https://github.com/obsidiansystems/nix/commits/split_build_cc_old so we switch methods and recover @regnat's breaking down the big split into interated splits if we like.
Sadly that might matter
So since git will not store nice patches that show how the file is split, when a PR that predates the now-mainlined split is rebased git will have a hard time figuring out what to do. (Is there e |
…h-2', 'split_build_hh-3' and 'split_build_hh-4' into split_build_cc
I was talking about the old version: master...obsidiansystems:split_build_cc_old. If you rebased you'd end up with only 4 commits, instead of 17. But handling all the open PRs nicely is more important than clean commit history.
There is actually |
In other news, I added another round of this splitting |
@Ericson2314 Thanks, looks great now! |
Thank you! It means a lot :). |
Bad news :( Having done more merges since this was merged, I'm noticing Raymon Chen's method isn't working as well as it should. The issue is 3bab1c5, despite being a very simple removing of code, shows up as hot garbage. On the command line, one can demonstrate this by comparing git show --patience 3bab1c5bb0a56f850a7bc1bacc9f974b108cf601 with git show 3bab1c5bb0a56f850a7bc1bacc9f974b108cf601 Evidentially the shear amount of deleted code is fooling git, and it starts aligning blank lines instead, with chaos naturally ensuing. One thing I could attempt is to make a new branch off the parent of that commit, deleting the code little by little so git wouldn't get lost, and then merging that back in. Another thing is my original offer of fixing merge conflicts for others still stands. Very sorry this latest version of the history wasn't the panacea I thought it would be. |
There are a few settings that can be tweaked, |
Oh whew! That makes me feel a lot better. Thanks so much, @Mathnerd314. |
Opening this because I think @edolstra's opinion has changed, and this would certainly be useful to to me doing incremental debug builds and being able to page less code into my head at a time.
I merged each of the original commits in succession, and basically re-copped code as needed. There were no interesting conflicts.
CC @regnat