feat: pre read src

This commit is contained in:
崔竞宁
2022-12-13 09:38:59 +08:00
parent c5de5e5554
commit b7a44e4c00

View File

@@ -19,7 +19,7 @@ import (
)
const (
batchSize = 1024 * 1024
batchSize = 1 * 1024 * 1024
)
var (
@@ -207,8 +207,10 @@ func (c *Copyer) streamCopy(ctx context.Context, dsts []chan []byte, src *mmap.R
return fmt.Errorf("slice mmap fail, %w", err)
}
copyed := make([]byte, len(buf))
copy(copyed, buf)
for _, ch := range dsts {
ch <- buf
ch <- copyed
}
nr := len(buf)