func BenchmarkAddition(b *testing.B) { for i := 0; i < b.N; i++ { x := 1 + 2 } }
func BenchmarkSorting(b *testing.B) { s := []int{5, 3, 8, 2, 1, 1, 9, 7} for i := 0; i < b.N; i++ { sort.Ints(s) } }This benchmark function sorts an array of integers using the "sort" package in Go. It runs b.N times to measure the performance of sorting large arrays. The "testing" package is a standard library in Go language.