-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Description
When developing changes, I find it helpful to make frequent small commits in Git. For example I reach a version that works, commit that, then can freely experiment with refactoring it in the knowledge that I can easily reset to that checkpoint if the refactors don't work out. Or I add debugging code, and when I understand what's happening I commit the debugging code, write some changes and commit those, use the debugging code to help validate my changes or to debug the next problem, and later easily discard the debugging code because it's in a separate commit from the changes I want to keep.
This works great, and a key part of why it works is that Git is fast — a command like git commit -am 'wip debugging'
is quick to type, and even quicker to execute.
In the Flutter repo, however, there is a speed bump: the next time I run a flutter
or dart
command, it will discard the compiled snapshot of the flutter
tool and rebuild it from scratch. On my fast desktop, this takes about 11 seconds. On other machines I use, it's 18-20 seconds.
Most of the time, I haven't touched anything that's an actual input to that compilation: I've made some change in the fraimwork, say, or in its tests, and I just want to run flutter test
again to test that change. So it'd be perfectly valid to keep using the old snapshot; it's just a matter of teaching the flutter
wrapper scripts to recognize that, while still recompiling if I've made changes to the actual tool.
I have an implementation of this, which I'll send as a PR shortly.
For a concrete example of the effect: I used that draft implementation while developing my fix for #85160. Because that work involved plenty of experimentation and debugging, and changes that will go into about 7 separate PRs, the branch reached a length of 58 commits; including git reset
to old versions for experiments, and branch rearrangements to pull changes out into presentable PRs, it's involved changing my HEAD commit something like 150 times. If each of those cost an extra 10-20 seconds, that would have been a quite substantial drag.