That's a much easier way to know something's changed if you're going to the trouble of keeping state.
That's a much easier way to know something's changed if you're going to the trouble of keeping state.
"Checksumming every output after building it is somewhat slow."
"Mostly this is not too serious: the file is probably already in disk cache (since you just wrote it a moment ago!)"
> Checksumming every input file before building is very slow
If you have a very new CPU you might have hardware SHA support.
Related example: on a cloud instance with SSD drive, I have scripts that generate a ~10GiB file, then immediately after (while it might still be in cache), calculating an md5sum still takes tens of seconds (maybe it wasn't in cache? I've not investigated deeply). It's just an example of a case that falls outside of that "Mostly" category.
$ time dd if=/dev/zero bs=1048576 count=1024 | md5sum
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 2.104 s, 510 MB/s
cd573cfaace07e7949bc0c46028904ff -
real 0m2.108s
user 0m1.891s
sys 0m0.628sEdit: "sum -s" is faster for me, but the man page doesn't give much info on what the algorithm is.