Closed sbinet closed 8 years ago
see https://github.com/sbinet/npyio/commit/dca281fae51d31857da5490c10bca634b16132b6 for the kind of performances one can recoup
How does that compare with the user providing a bufio.Buffer as the target io.Writer?
dunno. the benchmark numbers were crafted with a ioutil.Discard
.
I doubt it would make a difference (most likely the price is, as I said, coming from the reflection happening inside binary.Write
. price we pay for each element of the slice.)
as part of a PR fixing this issue, I'll create also a few r/w benchmarks for Dense
and Vector
.
this should also be interesting to make sure #344 does not introduce any performance regression.
Yeah, I think you are right. I think your approach is the correct one.
and, as can be seen above, I have a CL (not yet a PR) leveraging these benchmarks to show some interesting improvements: https://github.com/sbinet/gonum-matrix/commit/73a71bae30ddee85690b1c0c0ec601c85e2abcfa
calling
binary.Write(w, binary.LittleEndian, v)
in a tight-ish loop, especially whenv=int64|float64
, is less than optimized.fix it.