hysteria/core/server/copy_benchmark_test.go
prudhvi 0e2b37ad6c
Reuse 32KB buffers in copyBufferLog with sync.Pool (#1572)
* Bolt: Reuse 32KB buffers in copyBufferLog with sync.Pool

Delete .jules directory

* Add benchmark test for copyBufferLog function
2026-05-15 22:19:36 -07:00

23 lines
379 B
Go

package server
import (
"bytes"
"io"
"testing"
)
func BenchmarkCopyBufferLog(b *testing.B) {
srcData := make([]byte, 1024*1024) // 1MB
for i := range srcData {
srcData[i] = byte(i)
}
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
src := bytes.NewReader(srcData)
dst := io.Discard
copyBufferLog(dst, src, func(n uint64) bool { return true })
}
}