SHARE
TWEET
Untitled
a guest
Sep 5th, 2018
132
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- diff --git a/buffer.go b/buffer.go
- index 54c6226..bb6e96e 100644
- --- a/buffer.go
- +++ b/buffer.go
- @@ -16,7 +16,6 @@ import (
- type Buffer struct {
- buf []byte // contents are the bytes buf[off : len(buf)]
- off int // read at &buf[off], write at &buf[len(buf)]
- - bootstrap *[64]byte // memory to hold first slice; helps small buffers avoid allocation.
- lastRead readOp // last read operation, so that Unread* can work correctly.
- // FIXME: it would be advisable to align Buffer to cachelines to avoid false
- @@ -25,7 +24,7 @@ type Buffer struct {
- // New returns ready-to-use empty Buffer.
- func New() Buffer {
- - return Buffer{bootstrap: new([64]byte)}
- + return Buffer{buf: new([64]byte)[:0]}
- }
- // The readOp constants describe the last action performed on
- @@ -129,11 +128,6 @@ func (b *Buffer) grow(n int) int {
- if i, ok := b.tryGrowByReslice(n); ok {
- return i
- }
- - // Check if we can make use of bootstrap array.
- - if b.buf == nil && n <= len(b.bootstrap) {
- - b.buf = b.bootstrap[:n]
- - return 0
- - }
- c := cap(b.buf)
- if n <= c/2-m {
- // We can slide things down instead of allocating a new
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
