Skip to content

Commit

Permalink
adding defer
Browse files Browse the repository at this point in the history
  • Loading branch information
lemire committed Apr 23, 2024
1 parent 823cec1 commit 7c14d0e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions 2023/05/19/cgotest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ func BenchmarkAllocate(b *testing.B) {
}
}

func BenchmarkAllocateDefer(b *testing.B) {
for j := 0; j < b.N; j++ {
p := Allocate()
defer Free(p)
}
}

func BenchmarkAllocateFree(b *testing.B) {
for j := 0; j < b.N; j++ {
AllocateFree()
Expand Down

0 comments on commit 7c14d0e

Please sign in to comment.