It is difficult to tell what may be impacting performance and the code itself might not perform the same across different platforms. Just a few comments:
- MD5 should be around 30~40$ faster. Try with a smaller directory or another drive
- Filtering files should improve performance, as there are less hashes to compute
- In my tests, the execution time of the first run and subsequent runs is about the same. For the 260 GB, it was 2 hr 45 min first and then 2 hr 59 min for the following run
In regards to the difference in checksum algorithms, I made a test on a another with NMVe drive on a 9.3GB folder containing 237 files
MD5: First run 1 Min 51 Sec; second run 1 Min 1 Sec
SHA256: First run 3 Min 11 Sec; second run 3 Min 9 Sec