Skip to content

Commit

Permalink
Merge pull request #34 from nirs/zero-reads
Browse files Browse the repository at this point in the history
Optimize zero reads
  • Loading branch information
AkihiroSuda authored Oct 20, 2024
2 parents b119fa3 + 5f0db7b commit 5f33c4a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion image/qcow2/qcow2.go
Original file line number Diff line number Diff line change
Expand Up @@ -902,10 +902,15 @@ func readZero(p []byte, off int64, sz uint64) (int, error) {
l = 0
}
err = io.EOF
p = p[:l]
}
for i := 0; i < l; i++ {

// Optimized by the compiler to memclr call.
// https://go-review.googlesource.com/c/go/+/2520
for i := range p {
p[i] = 0
}

return l, err
}

Expand Down

0 comments on commit 5f33c4a

Please sign in to comment.