Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added and updated benchmarks #397

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions api/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"crypto/rand"
"crypto/sha256"
"fmt"
"strings"
"testing"

"github.com/google/go-cmp/cmp"
Expand Down Expand Up @@ -144,3 +145,19 @@ func TestLeafBundle_UnmarshalText(t *testing.T) {
})
}
}

func BenchmarkLeafBundle_UnmarshalText(b *testing.B) {
bs := bytes.Buffer{}
for i := range 222 {
// Create leaves of different lengths for interest in the parsing / memory allocation
leafStr := strings.Repeat(fmt.Sprintf("Leaf %d", i), i%20)
_, _ = bs.Write(tessera.NewEntry([]byte(leafStr)).MarshalBundleData(uint64(i)))
}
rawBundle := bs.Bytes()
for i := 0; i < b.N; i++ {
tile := api.EntryBundle{}
if err := tile.UnmarshalText(rawBundle); err != nil {
b.Fatal(err)
}
}
}
3 changes: 1 addition & 2 deletions storage/internal/integrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,8 @@ func BenchmarkIntegrate(b *testing.B) {
m := newMemTileStore[api.HashTile]()

chunkSize := 200
numChunks := 256
seq := uint64(0)
for chunk := 0; chunk < numChunks; chunk++ {
for chunk := 0; chunk < b.N; chunk++ {
oldSeq := seq
c := make([]SequencedEntry, chunkSize)
for i := range c {
Expand Down
Loading