Let's say I have written different functions to compute Fibonacci's nth number:
func fiboIterative(n int) {
...
}
func fiboRecursive(n int) {
...
}
And I'd like to get a chart showing the performances of each function depending on the value of n.
So far, I have been benchmarking using the built-in testing
package which prints the time per operations to the console. Is there a simple way/package to run the benchmark for multiple values of n, stores the result in a csv or something similar and then plot them?
I would have expected something like this to be built in... It is weird to provide a benchmarking utility without this
It doesn't seem obvious to include a cross-platform plot library within the language packages, that will have to be maintained.
As it is now, you need to rely on third-party projects for a plot feature for benchmarks.
For example, the project aybabtme/benchkit
generates svg plot pictures from benchmarks.
lightweight, feather touch, benchmarking kit. In comparison to the standard pprof utilities, this package is meant to help generating graphs and other artifacts.