contentenc: encryptBlocksParallel: explain why last part runs in new goroutine
The result is counter-intuitive, so explain it here.
This commit is contained in:
parent
ff210a06fb
commit
abc59fa968
@ -219,7 +219,11 @@ func (be *ContentEnc) encryptBlocksParallel(plaintextBlocks [][]byte, ciphertext
|
|||||||
low := i * groupSize
|
low := i * groupSize
|
||||||
high := (i + 1) * groupSize
|
high := (i + 1) * groupSize
|
||||||
if i == ncpu-1 {
|
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)
|
high = len(plaintextBlocks)
|
||||||
}
|
}
|
||||||
be.doEncryptBlocks(plaintextBlocks[low:high], ciphertextBlocks[low:high], firstBlockNo+uint64(low), fileID)
|
be.doEncryptBlocks(plaintextBlocks[low:high], ciphertextBlocks[low:high], firstBlockNo+uint64(low), fileID)
|
||||||
|
Loading…
Reference in New Issue
Block a user