Codebase list golang-github-vbauerster-mpb / eda3fdc
sane initial cap for buffers prepend and append = 128 filler = 256 Vladimir Bauer 2 years ago
1 changed file(s) with 3 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
1313 "github.com/vbauerster/mpb/v8/decor"
1414 )
1515
16 // buffer capacity allocated per bar structure (prepend|filler|append)
17 const initialStructBufCap = 256
1816 const defaultRefreshRate = 150 * time.Millisecond
1917
2018 // DoneError represents use after `(*Progress).Wait()` error.
466464 }
467465 }
468466
469 for i := 0; i < len(bs.buffers); i++ {
470 bs.buffers[i] = bytes.NewBuffer(make([]byte, 0, initialStructBufCap))
471 }
467 bs.buffers[0] = bytes.NewBuffer(make([]byte, 0, 128)) // prepend
468 bs.buffers[1] = bytes.NewBuffer(make([]byte, 0, 128)) // append
469 bs.buffers[2] = bytes.NewBuffer(make([]byte, 0, 256)) // filler
472470
473471 return bs
474472 }