Skip to content

Commit

Permalink
Add benchmark for Sum
Browse files Browse the repository at this point in the history
  • Loading branch information
thoas committed Jan 15, 2017
1 parent a1d9520 commit e8356e7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions benchmark_test.go
Expand Up @@ -57,3 +57,20 @@ func BenchmarkUniq(b *testing.B) {
}
})
}

func BenchmarkSum(b *testing.B) {
r := rand.New(rand.NewSource(seed))
testData := sliceGenerator(sliceSize, r)

b.Run("SumInt64", func(b *testing.B) {
for n := 0; n < b.N; n++ {
SumInt64(testData)
}
})

b.Run("Sum", func(b *testing.B) {
for n := 0; n < b.N; n++ {
Sum(testData)
}
})
}

0 comments on commit e8356e7

Please sign in to comment.