summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/contentenc/content.go6
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)