ceremonyclient/pebble/internal/rawalloc/rawalloc_test.go
Cassandra Heart 2e2a1e4789
v1.2.0 (#31)
2024-01-03 01:31:42 -06:00

33 lines
695 B
Go

// Copyright 2020 The LevelDB-Go and Pebble Authors. All rights reserved. Use
// of this source code is governed by a BSD-style license that can be found in
// the LICENSE file.
package rawalloc
import (
"fmt"
"testing"
)
var sizes = []int{16, 100, 1024, 1024 * 10, 1024 * 100, 1024 * 1024}
func BenchmarkRawalloc(b *testing.B) {
for _, size := range sizes {
b.Run(fmt.Sprintf("rawalloc-%d", size), func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = New(size, size)
}
})
}
}
func BenchmarkMake(b *testing.B) {
for _, size := range sizes {
b.Run(fmt.Sprintf("make-%d", size), func(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = make([]byte, size)
}
})
}
}