User fewer hasher routines when there are many folders.

This commit is contained in:
Jakob Borg
2015-04-29 20:46:32 +02:00
parent a9c31652b6
commit 756c5a2604
3 changed files with 28 additions and 7 deletions

View File

@@ -89,14 +89,9 @@ func (w *Walker) Walk() (chan protocol.FileInfo, error) {
return nil, err
}
workers := w.Hashers
if workers < 1 {
workers = runtime.NumCPU()
}
files := make(chan protocol.FileInfo)
hashedFiles := make(chan protocol.FileInfo)
newParallelHasher(w.Dir, w.BlockSize, workers, hashedFiles, files)
newParallelHasher(w.Dir, w.BlockSize, w.Hashers, hashedFiles, files)
go func() {
hashFiles := w.walkAndHashFiles(files)