Skip to content

Instantly share code, notes, and snippets.

@sheki
Created November 17, 2015 02:05
Show Gist options
  • Select an option

  • Save sheki/b231ac7e79b70d0711e8 to your computer and use it in GitHub Desktop.

Select an option

Save sheki/b231ac7e79b70d0711e8 to your computer and use it in GitHub Desktop.
package boom_test
import (
"testing"
)
func BenchmarkHello(b *testing.B) {
for i := 0; i < b.N; i++ {
fibReadable(100000)
}
}
func fibReadable(n uint) uint{
old := uint(0)
current := uint(1)
if n == 0 {
return 0
}
if n == 1 {
return 1
}
var temp uint
for i :=uint(0); i < n-2; i++ {
temp = current
current = old + current
old = temp
}
return current
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment