contentenc: encryptBlocksParallel: explain why last part runs in new goroutine

The result is counter-intuitive, so explain it here.
This commit is contained in:
Jakob Unterwurzacher 2020-02-15 21:28:12 +01:00
parent ff210a06fb
commit abc59fa968
1 changed files with 5 additions and 1 deletions

View File

@ -219,7 +219,11 @@ func (be *ContentEnc) encryptBlocksParallel(plaintextBlocks [][]byte, ciphertext
low := i * groupSize
high := (i + 1) * groupSize
if i == ncpu-1 {
// Last group, pick up any left-over blocks
// Last part picks up any left-over blocks
//
// The last part could run in the original goroutine, but
// doing that complicates the code, and, surprisingly,
// incurs a 1 % performance penalty.
high = len(plaintextBlocks)
}
be.doEncryptBlocks(plaintextBlocks[low:high], ciphertextBlocks[low:high], firstBlockNo+uint64(low), fileID)