Created
April 23, 2019 22:14
-
-
Save lowewenzel/a3d07a1664c58e9f26317d2fcaffb087 to your computer and use it in GitHub Desktop.
Linear Sum Function Benchmarks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "testing" | |
func BenchmarkCalcSum(b *testing.B) { | |
// run the CalcSum function b.N times | |
for n := 0; n < b.N; n++ { | |
numbers := []int{1, 5, 2, 7, 1, n} | |
CalcSum(numbers, 0, len(numbers)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment