Skip to content

Commit

Permalink
btf: add benchmark for Spec.TypeByID
Browse files Browse the repository at this point in the history
Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
  • Loading branch information
lmb committed Jan 23, 2024
1 parent c6b5844 commit 5266d91
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions btf/btf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,3 +512,16 @@ func BenchmarkSpecCopy(b *testing.B) {
spec.Copy()
}
}

func BenchmarkSpecTypeByID(b *testing.B) {
spec := vmlinuxTestdataSpec(b)

b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, err := spec.TypeByID(1)
if err != nil {
b.Fatal(err)
}
}
}

0 comments on commit 5266d91

Please sign in to comment.