Skip to content

Instantly share code, notes, and snippets.

@lowewenzel
Created April 23, 2019 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lowewenzel/a3d07a1664c58e9f26317d2fcaffb087 to your computer and use it in GitHub Desktop.
Save lowewenzel/a3d07a1664c58e9f26317d2fcaffb087 to your computer and use it in GitHub Desktop.
Linear Sum Function Benchmarks
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