also, if you find any odd behavior, or API issues, or possible improvements, etc...
feel free to reach out on the gonum mailing list:
-
gonu...@googlegroups.com
(feel free to also reach out if Gonum did a good job at fulfilling your use case :P)
-s
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, February 20th, 2021 at 8:13 PM, TiT8 <
lorenz...@gmail.com> wrote:
> Awesome !! Thank you.
>
> Il giorno sabato 20 febbraio 2021 alle 19:59:37 UTC+1 DrGo ha scritto:
>
> > Dear Lorenzo,Here’s a link to an old but still relevant tutorial on benchmarking Go programs
> > > I want to say that I was not trying to benchmark the two version of Go (two weeks ago I had go1.15.8, now 1.16). At the beginning I was trying to do some linear algebra with Go as a free “alternative of Matlab”, so I noted the difference between the exe coming from the two versions.Now I have understand that this is not the way to measure the specific performance of my issue. I will learn more and also testing.
> > >
> > > Sorry for your time, but thank you very much for your fast help.Il giorno sabato 20 febbraio 2021 alle 17:31:24 UTC+1 Volker Dobler ha scritto:
> > >
> > > > (premature send, sorry)
> > > >
> > > > 4. Your matrix multiplication is just a few CPU instructions, it is hardto measure something tiny reliable. So use larger matrixes.5. You are benchmarking also how fast you can format and outputthe results to stdout. This might or might not be intentional butprobably is just wrong.6. There is no point in comparing Go 1.15 and Go 1.16 with microbenchmarkswhich do not properly measure what you think they do. Your code spendsfar too much time in a lot of things. Come up with a _proper_ benchmarkbased on testing.B and go test. Make sure this benchmark is stable. Makesure this benchmarks really benchmarks what you are trying to measure.Then redo the benchmarks 10 times and compare them doing properstatistics.
> > > >
> > > > V.
> > > >
> > > > On Saturday, 20 February 2021 at 15:48:32 UTC+1 TiT8 wrote:
> > > >
> > > > > Hello everyone,I'm Lorenzo and I'm not a computer scientist, I have used some "Matlab" and I am new with Go (surprisingly fast, simple and elegant).
> > > > >
> > > > > I'm trying to do some basic operation on matrix with the "Gonum" package using vectorization. I was curious about the speed of development and the performance (repeat... surprisingly for me!). So I've tried to do some measures:
> > > > >
> > > > > package mainimport ( "fmt" "time" "
gonum.org/v1/gonum/mat")func main() { p := mat.NewDense(3, 3, nil) a := mat.NewDense(3, 3, []float64{ 1, 2, 3, 1, 2, 3, 1, 2, 3, }) start := time.Now()p.Mul(a, a) // element-wise fmt.Printf("%v\n", mat.Formatted(p, mat.Prefix(""), mat.Squeeze())) p.Add(a, a) fmt.Printf("%v\n", mat.Formatted(p, mat.Prefix(""), mat.Squeeze())) p.MulElem(a, a) fmt.Printf("%v\n", mat.Formatted(p, mat.Prefix(""), mat.Squeeze())) fmt.Println(time.Since(start))}
> > > > >
> > > > > Well... when I run the "go run mat.go" command the result time is about 150 microseconds, but when I run "go build" and then execute the binary the result time is about 4 milliseconds. This happen when I use go1.16.
> > > > >
> > > > > When I use go1.15.8, on the same code, the exe is faster (about 120 microseconds) then the "go run mat.go" (about 180 microseconds). One order of magnitude faster than go1.16 exe (and basic Matlab).
> > > > >
> > > > > So:
> > > > >
> > > > > - am I in error with the code (sorry, it's all new for me)? If yes, where is my fault?
> > > > > - if the "benchmark" was correct, why go1.16 build executable is slower than go1.15.8 exe and "go run" command?
> > > > > - Is it my machine's fault or Gonum package or what?
> > > > > - Do you also have these values?
> > > > >
> > > > > My pc: HP ELITEBOOK 8560w Intel(R) Core(TM) i7-2670QM CPU @ 2.20GHz, 2201 Mhz, 4 Core(s), 8 Logical Processor(s) x64.I am on the Windows Subsystem Linux 2.
> > > > >
> > > > > Sorry for my English, I hope you understand my issue, thank you for the attention
>
> --
>
> You received this message because you are subscribed to the Google Groups "golang-nuts" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an email to
golang-nuts...@googlegroups.com.
>
> To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/b7b558d9-d14c-4ba7-bcb8-977015e01bfdn%40googlegroups.com.