Created
June 25, 2022 21:44
-
-
Save hkaya15/2a0a8c17651dd414fa671be2579dc91f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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