Skip to content

Commit

Permalink
defaultStructBufCap = 256
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauerster committed Mar 28, 2024
1 parent 40eeb0c commit 2510d1d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion draw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ func newTestState(filler BarFiller) *bState {
filler: filler,
}
for i := 0; i < len(bs.buffers); i++ {
bs.buffers[i] = bytes.NewBuffer(make([]byte, 0, 512))
bs.buffers[i] = bytes.NewBuffer(make([]byte, 0, defaultStructBufCap))
}
return bs
}
8 changes: 4 additions & 4 deletions progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"github.com/vbauerster/mpb/v8/decor"
)

const (
defaultRefreshRate = 150 * time.Millisecond
)
// buffer capacity allocated per bar structure (prepend|filler|append)
const defaultStructBufCap = 256
const defaultRefreshRate = 150 * time.Millisecond

// DoneError represents use after `(*Progress).Wait()` error.
var DoneError = fmt.Errorf("%T instance can't be reused after %[1]T.Wait()", (*Progress)(nil))
Expand Down Expand Up @@ -468,7 +468,7 @@ func (s pState) makeBarState(total int64, filler BarFiller, options ...BarOption
}

for i := 0; i < len(bs.buffers); i++ {
bs.buffers[i] = bytes.NewBuffer(make([]byte, 0, 512))
bs.buffers[i] = bytes.NewBuffer(make([]byte, 0, defaultStructBufCap))
}

return bs
Expand Down

0 comments on commit 2510d1d

Please sign in to comment.