Add async readahead buffer

This adds an async read buffer of 4x4MB when copying files >10MB.

This fixes #164 and reduces the number of IO operations for copy/move.
This commit is contained in:
Klaus Post
2015-10-12 08:30:27 +01:00
committed by Nick Craig-Wood
parent ab9f521cbd
commit 6344c3051c
3 changed files with 473 additions and 0 deletions
+6
View File
@@ -198,6 +198,12 @@ tryAgain:
ErrorLog(src, "Failed to open: %s", err)
return
}
// On big files add a buffer
if src.Size() > 10<<20 {
in0, _ = newAsyncReader(in0, 4, 4<<20)
}
in := NewAccount(in0, src) // account the transfer
if doUpdate {