daily pastebin goal
24%
SHARE
TWEET

Untitled

a guest Sep 5th, 2018 132 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/buffer.go b/buffer.go
  2. index 54c6226..bb6e96e 100644
  3. --- a/buffer.go
  4. +++ b/buffer.go
  5. @@ -16,7 +16,6 @@ import (
  6.  type Buffer struct {
  7.         buf       []byte    // contents are the bytes buf[off : len(buf)]
  8.         off       int       // read at &buf[off], write at &buf[len(buf)]
  9. -       bootstrap *[64]byte // memory to hold first slice; helps small buffers avoid allocation.
  10.         lastRead  readOp    // last read operation, so that Unread* can work correctly.
  11.  
  12.         // FIXME: it would be advisable to align Buffer to cachelines to avoid false
  13. @@ -25,7 +24,7 @@ type Buffer struct {
  14.  
  15.  // New returns ready-to-use empty Buffer.
  16.  func New() Buffer {
  17. -       return Buffer{bootstrap: new([64]byte)}
  18. +       return Buffer{buf: new([64]byte)[:0]}
  19.  }
  20.  
  21.  // The readOp constants describe the last action performed on
  22. @@ -129,11 +128,6 @@ func (b *Buffer) grow(n int) int {
  23.         if i, ok := b.tryGrowByReslice(n); ok {
  24.                 return i
  25.         }
  26. -       // Check if we can make use of bootstrap array.
  27. -       if b.buf == nil && n <= len(b.bootstrap) {
  28. -               b.buf = b.bootstrap[:n]
  29. -               return 0
  30. -       }
  31.         c := cap(b.buf)
  32.         if n <= c/2-m {
  33.                 // 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. OK, I Understand
 
Top