mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-10 18:57:57 +08:00
more memory tweaks
This commit is contained in:
parent
9b1c99e9aa
commit
027920540f
@ -36,9 +36,11 @@ func bindDuplexNoCopy(a, b pipes.Duplex) {
|
||||
}
|
||||
}
|
||||
|
||||
var globuf = make([]byte, 4*1024*1024)
|
||||
|
||||
func bindDuplexWithCopy(a, b pipes.Duplex) {
|
||||
dup := func(byt []byte) []byte {
|
||||
n := make([]byte, len(byt))
|
||||
n := globuf[:len(byt)]
|
||||
copy(n, byt)
|
||||
return n
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
|
||||
var log = util.Logger("chunk")
|
||||
|
||||
var DefaultSplitter = &SizeSplitter{Size: 1024 * 512}
|
||||
var DefaultSplitter = &SizeSplitter{Size: 1024 * 256}
|
||||
|
||||
type BlockSplitter interface {
|
||||
Split(r io.Reader) chan []byte
|
||||
|
||||
@ -22,7 +22,7 @@ const (
|
||||
ChanBuffer = 10
|
||||
|
||||
// MaxMessageSize is the size of the largest single message
|
||||
MaxMessageSize = 1 << 21 // 4 MB
|
||||
MaxMessageSize = 1 << 20
|
||||
|
||||
// HandshakeTimeout for when nodes first connect
|
||||
HandshakeTimeout = time.Second * 5
|
||||
|
||||
Loading…
Reference in New Issue
Block a user