diff options
author | Jakob Unterwurzacher | 2020-02-15 21:28:12 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2020-02-15 21:28:12 +0100 |
commit | abc59fa96802f1b79fc92ba3a4ae78b58b905535 (patch) | |
tree | bb6d4ce5ea88de34d7bc7f8d31577a93b50adf38 /internal/contentenc/content.go | |
parent | ff210a06fb3097eecd5668ddb3ace9c76873eb00 (diff) |
contentenc: encryptBlocksParallel: explain why last part runs in new goroutine
The result is counter-intuitive, so explain it here.
Diffstat (limited to 'internal/contentenc/content.go')
-rw-r--r-- | internal/contentenc/content.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/internal/contentenc/content.go b/internal/contentenc/content.go index 81864d4..697026a 100644 --- a/internal/contentenc/content.go +++ b/internal/contentenc/content.go @@ -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) |