Reduce allocations while hash scanning

This commit is contained in:
Jakob Borg
2014-08-12 13:52:36 +02:00
parent 939dd5cb31
commit f51b775698
4 changed files with 20 additions and 7 deletions

View File

@@ -49,7 +49,15 @@ func hashFile(dir string, blockSize int, outbox, inbox chan protocol.FileInfo) {
continue
}
blocks, err := Blocks(fd, blockSize)
fi, err := fd.Stat()
if err != nil {
fd.Close()
if debug {
l.Debugln("stat:", err)
}
continue
}
blocks, err := Blocks(fd, blockSize, fi.Size())
fd.Close()
if err != nil {