sort_by may call the comparator many times, so the previous tiebreaker re-read each duplicate file's metadata on every comparison. With N duplicates that's O(N log N) stat calls, and the ordering could flip mid-sort if a file was touched concurrently. Snapshot mtime per file up front and sort on the cached values. |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||