[Feature Request / Idea]: Why use hashes?
- Dominant language
- Rust
- Stars
- 2
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
### Suggestion / Feature Request
I saw in the code, you use
```
if hash_file(left_entry.path())? == hash_file(&maybe_in_right)?
```
This reads and hashes the first file and then reads and hashes the second file.
If you anyhow completely read both files, there is no need to apply a hash. You can just take the two Readers and compare byte-by-byte, e.g. something like https://users.rust-lang.org/t/efficient-way-of-checking-if-two-files-have-the-same-content/74735
Note that this is even faster:
- no computation needed to calculate the hash (Ok, usually the bottleneck is the reading from disc...)
- In case of different files, you can early abort and don't need to read the complete files.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the comparison code containing `hash_file(left_entry.path())? == hash_file(&maybe_in_right)?`; the issue names no file or test. Replace the hashing-based equality check with byte-by-byte comparison that can stop at the first difference, then verify existing folder-comparison behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100