-
Notifications
You must be signed in to change notification settings - Fork 696
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
CopyFile: Don't touch copyFile target if it is identical. #1501
Conversation
Do we want to replace |
I'm leaving this for @dcoutts to review. |
I've thought about that, but I couldn't see the benefits. Touching files in build systems when you don't have to always causes trouble, and the performance impact seems minimal. (Also, given the amount of helper functions that call |
I have not mentioned some example benefits by the way: |
Hmm, interesting. I'd also be inclined to only use this in the couple places where it is necessary, but the comment about reinstalls is interesting. Still, it does make me a tad nervous to do it everywhere. I cannot forsee all the consequences of not updating timestamps. |
#1537 includes parts of this request. I have not changed From here on we can gradually work on replacing individual |
Why should there? If a file's content has not changed, there is no reason to tell anything in the system the impression that it has. Or is there? |
Don't worry about not updating the timestamp. |
Here's the kind of problem I see: Admittedly, not updating the mtime of the output may prevent a cascade of unnecessary rebuilds further down the line (and this behaviour we definitely do want), but something doesn't feel right when the first step is unnecessarily duplicated. Were I writing a Makefile, I might try to work around this as follows:
That is, use Of course, this issue is not exclusive to |
tl;dr: lots of tools use mtime to indicate up-to-date-ness WRT its dependencies, even though it ought to be an indication of whether the file has actually changed. We want to keep separate these two attributes of an output file. |
I see what you mean. I think the difference is the follwoing: There are two types of build-system like things:
Current-vs-desired systems work top-down, i.e. for the output that you demand, they figure out what needs to be built for that, continue recursively and on each step apply their "updatedness metric" like mtime or looking something up in a metadata database (like shake) to avoid duplicate work. Task runners work bottom-up, executing steps one after the other. They avoid duplicate work by discovering that something is not necessary as they build up, e.g. by seeing that the package that I have just built has the same hash as the package that is already installed (so the install step can be skipped). Task runners can generally avoid less recompilation than Current-vs-desired systems (which is why projects like You probably agree that the problem you mentioned only arises in the first kind of system (like your I think that Cabal is a task runner. That being said, yes, replacing |
What's the status of this pull request? |
I'm not sure. The I expect we'll fiddle around with Cabal when we get sufficiently annoyed with long build times, but if anyone knows their way around the library better, please go ahead and add a |
@nh2 do you have any particular places in the code where you want to apply this, now when we already avoid relinking? If so, perhaps you could update this pull request to do so. If not, would you be OK with me closing this pull request until we've found a use case? If I'm a bit worried to change all the file copying outright, especially if we don't have a specific case that will be improved (performance-wise) by the change. |
I updated my pull request, making it more conservative as you suggest.
|
This can prevent a lot of recompilation when using ghc -M / -c.