Thread overview
[Issue 21593] Only update file time if file to be written already exists
Jan 30, 2021
Dlang Bot
Feb 03, 2021
Dlang Bot
January 30, 2021
https://issues.dlang.org/show_bug.cgi?id=21593

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #1 from Dlang Bot <dlang-bot@dlang.rocks> ---
@WalterBright updated dlang/dmd pull request #12169 "Fix Issue 21593 - Only update file time if file to be written already exists" fixing this issue:

- Fix Issue 21593 - Only update file time if file to be written already exists

https://github.com/dlang/dmd/pull/12169

--
January 30, 2021
https://issues.dlang.org/show_bug.cgi?id=21593

Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei@erdani.com

--- Comment #2 from Andrei Alexandrescu <andrei@erdani.com> ---
Not knowing about this I wrote another one: https://issues.dlang.org/show_bug.cgi?id=21594. Will copy the text from there here, and close that one:

It turns out that oftentimes the generated object file for a given .d file is identical to the preexisting one:

* The build is triggered by a change in a dependent file that was not material
to building this object file (most often)
* Only unittests were changed and this is not a unittest build
* Only documentation was changed

In that case it's worth reading the existing object file (block by block) and comparing it against the object file to be written.

* If the object files are different, proceed with writing as usual.
* If the file are identical, do NOT overwrite the file. Do touch it to announce
to tbe build system that the build has been done.

This should be particularly gainful on SSD drives, which are much cheaper to read than to write.

Comparison of files should be done block by block, not by slurping the entire object file. This is because once the headers are different all time spent reading the rest of the file is wasted.

--
January 30, 2021
https://issues.dlang.org/show_bug.cgi?id=21593

--- Comment #3 from Andrei Alexandrescu <andrei@erdani.com> ---
*** Issue 21594 has been marked as a duplicate of this issue. ***

--
January 30, 2021
https://issues.dlang.org/show_bug.cgi?id=21593

--- Comment #4 from Andrei Alexandrescu <andrei@erdani.com> ---
Related: https://issues.dlang.org/show_bug.cgi?id=21596

--
January 30, 2021
https://issues.dlang.org/show_bug.cgi?id=21593

--- Comment #5 from Andrei Alexandrescu <andrei@erdani.com> ---
Related: https://issues.dlang.org/show_bug.cgi?id=21597

--
February 03, 2021
https://issues.dlang.org/show_bug.cgi?id=21593

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #12169 "Fix Issue 21593 - Only update file time if file to be written already exists" was merged into master:

- 61b340226af7948995bced165617651509923860 by Walter Bright:
  Fix Issue 21593 - Only update file time if file to be written already exists

https://github.com/dlang/dmd/pull/12169

--