1
0
mirror of https://github.com/golang/go synced 2024-10-05 00:11:21 -06:00
go/src/pkg/io
Daniel Morsing fdc4ce6ec7 io: Prioritize WriterTos over ReaderFroms in Copy.
This only affects calls where both ReaderFrom and WriterTo are implemented. WriterTo can issue one large write, while ReaderFrom must Read until EOF, potentially reallocating when out of memory. With one large Write, the Writer only needs to allocate once.

This also helps in ioutil.Discard since we can avoid copying memory when the Reader implements WriterTo.

R=golang-dev, dsymonds, remyoudompheng, bradfitz
CC=golang-dev, minux.ma
https://golang.org/cl/9462044
2013-05-23 18:29:19 +02:00
..
ioutil all: remove now-unnecessary unreachable panics 2013-03-11 14:16:55 -07:00
io_test.go io: Prioritize WriterTos over ReaderFroms in Copy. 2013-05-23 18:29:19 +02:00
io.go io: Prioritize WriterTos over ReaderFroms in Copy. 2013-05-23 18:29:19 +02:00
multi_test.go Add a []byte argument to hash.Hash to allow an allocation to be saved. 2011-12-01 12:35:37 -05:00
multi.go io: use error, add EOF, avoid os 2011-11-01 21:48:52 -04:00
pipe_test.go various: a grab-bag of time.Duration cleanups. 2011-12-13 10:42:56 +11:00
pipe.go all: more typos 2012-03-02 11:15:45 -08:00