more memory tweaks

This commit is contained in:
Jeromy 2014-10-28 02:53:29 +00:00
parent 9b1c99e9aa
commit 027920540f
3 changed files with 5 additions and 3 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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