zeroshade commented on code in PR #41638:
URL: https://github.com/apache/arrow/pull/41638#discussion_r1600330050


##########
go/parquet/internal/encoding/types.go:
##########
@@ -185,7 +185,7 @@ func (b *PooledBufferWriter) Reserve(nbytes int) {
                b.buf = bufferPool.Get().(*memory.Buffer)
        }
 
-       newCap := utils.Max(b.buf.Cap()+b.offset, 256)
+       newCap := utils.Max(b.buf.Cap(), 256)

Review Comment:
   It's not "256 more bytes", it's giving a minimum. If you have a buffer which 
currently has less than 256 bytes as its capacity, we push its capacity to 256 
in order to reduce future reallocations (since this is a buffer pool and we'll 
eventually reuse the buffer). 
   
   If this becomes an issue for anyone we can definitely make this configurable 
or reduce it. but it does go a long way to reduce small allocations if you're 
writing small row groups



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to