feat: initial release
Assisted-by: GLM 5.3 Flash
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package engine
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// BenchmarkPoolRoundTrip measures the full borrow/return cycle at the
|
||||
// sizes the kernels actually request, including the clear-on-borrow
|
||||
// cost the pool contract pays. Run before and after touching the pool.
|
||||
func BenchmarkPoolRoundTrip(b *testing.B) {
|
||||
for _, n := range []int{64, 4096, 262144} {
|
||||
b.Run(fmt.Sprintf("n=%d", n), func(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
for b.Loop() {
|
||||
buf := GetFloat64Buf(n)
|
||||
buf[0] = 1 // touch one slot: prove the buffer is writable
|
||||
PutFloat64Buf(buf)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user