]> Cypherpunks repositories - gostls13.git/commit
io: reduce allocations in Pipe constructor
authorJoe Tsai <joetsai@digital-static.net>
Sun, 5 Mar 2023 03:53:14 +0000 (19:53 -0800)
committerJoseph Tsai <joetsai@digital-static.net>
Thu, 17 Aug 2023 16:25:48 +0000 (16:25 +0000)
commit56076c3080022f595541932fb4cea379939ec313
tree98daea6aae1028ccf36a8be41ef7ae2efe352bf3
parent469d9e26eec76341da8ebc4ef9cedb5bdb32ce73
io: reduce allocations in Pipe constructor

Rather than having PipeWriter and PipeReader a wrapper type on pipe,
make them have the same underlying memory representation and
rely instead of simply casting the same *pipe pointer
as either a *PipeReader or *PipeWriter to control the set of methods.

This reduces the number of allocations by 2,
going from a total of 6 down to 4 allocations.

Change-Id: I09207a00c4b7afb44c7773d752c5628a07e24fda
Reviewed-on: https://go-review.googlesource.com/c/go/+/473535
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/io/pipe.go