[Issue 21594] New: Writing object files should be read-then-write
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jan 30 13:56:01 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=21594
Issue ID: 21594
Summary: Writing object files should be read-then-write
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: andrei at erdani.com
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.
--
More information about the Digitalmars-d-bugs
mailing list