dougan1465 2015-01-20 10:05
浏览 84
已采纳

在Go中绘制基准测试结果

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?

  • 写回答

1条回答 默认 最新

  • duanren9163 2015-01-20 11:44
    关注

    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.

    https://github.com/aybabtme/benchkit/blob/master/benchplot/tar_memplot.png

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据