benchdraw
benchdraw copied to clipboard
Panics when running
I get a panic when running with the following benchmark.
corylanou@Corys-MBP-2:~/go/src/github.com/gopherguides/learn/_training/advanced/benchmarking/src/fib_new (master % u= origin/master)
$ cat benchmark.txt
goos: darwin
goarch: amd64
pkg: github.com/gopherguides/learn/_training/advanced/benchmarking/src/fib_new
BenchmarkFib-8 92689851 12.8 ns/op 0 B/op 0 allocs/op
PASS
ok github.com/gopherguides/learn/_training/advanced/benchmarking/src/fib_new 1.211s
corylanou@Corys-MBP-2:~/go/src/github.com/gopherguides/learn/_training/advanced/benchmarking/src/fib_new (master % u= origin/master)
$ benchdraw --x=source -filter=BencharkFib < ./benchmark.txt > ./out0.svg
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
gonum.org/v1/plot.(*Plot).NominalX(0xc00004b000, 0x0, 0x0, 0x0)
/Users/corylanou/go/src/gonum.org/v1/plot/plot.go:393 +0x206
github.com/cep21/benchdraw/internal.(*Plotter).createPlot(0x18269c0, 0x0, 0xc0000a60a0, 0x1, 0x7ffeefbff555, 0xb, 0x7ffeefbff546, 0x6, 0x137abb9, 0x5, ...)
/Users/corylanou/go/src/github.com/cep21/benchdraw/internal/plotter.go:78 +0x169
github.com/cep21/benchdraw/internal.(*Plotter).Plot(0x18269c0, 0x0, 0xc0000a60a0, 0x13eda80, 0xc00000e010, 0x137a3d7, 0x3, 0x1, 0x7ffeefbff555, 0xb, ...)
/Users/corylanou/go/src/github.com/cep21/benchdraw/internal/plotter.go:40 +0x103
main.(*Application).run(0x18269c0, 0x0, 0x0)
/Users/corylanou/go/src/github.com/cep21/benchdraw/main.go:196 +0xdc7
main.(*Application).main(0x18269c0)
/Users/corylanou/go/src/github.com/cep21/benchdraw/main.go:131 +0x2f
main.main()
/Users/corylanou/go/src/github.com/cep21/benchdraw/main.go:217 +0x2d
There is for sure something going on here. I'll look into it and get back. Thanks!!
Just following up, it's a bit more complicated to figure out than I thought :/ I wonder if it has to do with a single output. The panic is because it thinks there's nothing to draw. I still want to resolve it, however. I'll keep digging
Hello, same problem here with your sample data:
BenchmarkDecode/text=digits/level=speed/size=1e4-8 100 154125 ns/op 64.88 MB/s 40418 B/op 7 allocs/op
BenchmarkDecode/text=digits/level=speed/size=1e5-8 10 1367632 ns/op 73.12 MB/s 41356 B/op 14 allocs/op
BenchmarkDecode/text=digits/level=speed/size=1e6-8 1 13879794 ns/op 72.05 MB/s 52056 B/op 94 allocs/op
BenchmarkDecode/text=digits/level=default/size=1e4-8 100 147551 ns/op 67.77 MB/s 40418 B/op 8 allocs/op
BenchmarkDecode/text=digits/level=default/size=1e5-8 10 1197672 ns/op 83.50 MB/s 41508 B/op 13 allocs/op
benchdraw < ./src/change-benchmark > ./benchdraw.svg
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
gonum.org/v1/plot.(*Plot).NominalX(0xc00012a800, 0x0, 0x0, 0x0)
/home/boris/go/pkg/mod/gonum.org/v1/[email protected]/plot.go:393 +0x206
github.com/cep21/benchdraw/internal.(*Plotter).createPlot(0xc1be40, 0x0, 0xc0000620f0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x76ba58, 0x5, ...)
/home/boris/projects/benchdraw/internal/plotter.go:78 +0x169
github.com/cep21/benchdraw/internal.(*Plotter).Plot(0xc1be40, 0x0, 0xc0000620f0, 0x7e1c60, 0xc00000e018, 0x76b28b, 0x3, 0x1, 0x0, 0x0, ...)
/home/boris/projects/benchdraw/internal/plotter.go:40 +0x103
main.(*Application).run(0xc1be40, 0x0, 0x0)
/home/boris/projects/benchdraw/main.go:196 +0xdb5
main.(*Application).main(0xc1be40)
/home/boris/projects/benchdraw/main.go:131 +0x2f
main.main()
/home/boris/projects/benchdraw/main.go:217 +0x2d
Hi,
Sorry for the delay. This is indeed an issue and it's not as simple as I thought to resolve. Any help here or PR would be appreciated.