Closed sknat closed 4 years ago
Hi @lunixbochs Any thoughts on this ?
Please run gofmt on your changed files and force push a commit with test.go and the test binary removed
Right, sorry I went a bit quick pushing this. Things should be better now
I’m unsure about the performance of creating innerV in a loop. You can probably get a reference to the elements of the array and unpack directly to those, or even take a slice of the array and treat it like a slice.
It might be worth adding a benchmark and playing with some options: https://github.com/lunixbochs/struc/blob/master/bench_test.go
Hi @lunixbochs sorry for the delayed reply, I got dragged onto other things.
Right for the performance of the of the innerV
in the loop, didn't figure out a way to reflect Array in the first place.
Added benchmarks for slices & arrays to the PR with comparable results on my machine
BenchmarkArrayEncode-4 576452 1858 ns/op
BenchmarkSliceEncode-4 581444 1774 ns/op
BenchmarkArrayDecode-4 430996 2401 ns/op
BenchmarkSliceDecode-4 429949 2356 ns/op
Hi @lunixbochs Did you have a chance to take a look at the updated patch ? Thanks in advance !
Hi @lunixbochs sorry to push for this merge, but we're moving to a more 'official' repo for our project. We'd be better off without a "replace" line in our go.mod
😄
I just merged manually with a minor change to avoid allocating an intermediate array.
Great thanks a lot
The following snippet generates a segfault. I made this fix proposal & added the corresponding test.
Feel free to comment :)
Signed-off-by: Nathan Skrzypczak nathan.skrzypczak@gmail.com