Skip to content

Instantly share code, notes, and snippets.

@hkaya15
Created June 25, 2022 21:44
Show Gist options
  • Save hkaya15/2a0a8c17651dd414fa671be2579dc91f to your computer and use it in GitHub Desktop.
Save hkaya15/2a0a8c17651dd414fa671be2579dc91f to your computer and use it in GitHub Desktop.
package main
import (
"testing"
)
func Benchmark_fibonacci(b *testing.B) {
b.ReportAllocs()
for i:=0; i<b.N;i++{
fibonacci(25)
}
}
func Benchmark_memoization(b *testing.B) {
b.ReportAllocs()
for i:=0; i<b.N;i++{
memoization(25)
}
}
func Benchmark_tabulation(b *testing.B) {
b.ReportAllocs()
for i:=0; i<b.N;i++{
tabulation(25)
}
}
func Benchmark_fibDynamic(b *testing.B) {
b.ReportAllocs()
for i:=0; i<b.N;i++{
fibDynamic(25)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment