use buffers for pathJoin, to re-use buffers. (#17960)

```
benchmark                        old ns/op     new ns/op     delta
BenchmarkPathJoin/PathJoin-8     79.6          55.3          -30.53%

benchmark                        old allocs     new allocs     delta
BenchmarkPathJoin/PathJoin-8     2              1              -50.00%

benchmark                        old bytes     new bytes     delta
BenchmarkPathJoin/PathJoin-8     48            24            -50.00%
```
This commit is contained in:
Harshavardhana
2023-08-31 17:58:48 -07:00
committed by GitHub
parent ea93643e6a
commit b1c1f02132
4 changed files with 63 additions and 21 deletions

View File

@@ -1290,7 +1290,10 @@ func (api objectAPIHandlers) PostPolicyBucketHandler(w http.ResponseWriter, r *h
// instead of "copying" from source, we need the stream to be seekable
// to ensure that we can make fan-out calls concurrently.
buf := bytebufferpool.Get()
defer bytebufferpool.Put(buf)
defer func() {
buf.Reset()
bytebufferpool.Put(buf)
}()
md5w := md5.New()