[go-nuts] Why is more memory being used when encoding a slice of structs with smaller length

2024-03-11 Thread Kwaku Biney
Go version go version devel go1.23-e8b5bc63be linux/amd64 When using binary.Write for encoding a slice of structs, I encountered some weird behaviour where memory allocations in a particular path was more than I expected. I wrote some benchmarks in the standard library's encoding/binary packag

[go-nuts] Re: Named pipes blocking with O_NONBLOCK on Mac

2024-03-11 Thread Kwaku Biney
I think you put this issue on the Go issue board? https://github.com/golang/go/issues/66239 Seems like the bug has been confirmed or at least it's being looked at On Monday, March 11, 2024 at 2:04:19 PM UTC Jay Goel wrote: > Hello, > > I believe there is a bug where, on Mac, reading a named pipe

[go-nuts] Why is more memory being used when encoding a slice of structs with smaller length

2024-03-11 Thread Kwaku Biney
When using `binary.Write` for encoding a slice of structs, I encountered some weird behaviour where memory allocations in a particular path was more than I expected. I wrote some benchmarks in the standard library's encoding/binary package to demonstrate this. func BenchmarkWriteSlice1000Str

[go-nuts] Why is more memory being used when encoding a slice of structs with smaller length

2024-03-10 Thread Kwaku Biney
When using `binary.Write` for encoding a slice of structs, I encountered some weird behaviour where memory allocations in a particular path was more than I expected. I wrote some benchmarks in the standard library's encoding/binary package to demonstrate this. func BenchmarkWriteSlice1000Str

[go-nuts] A slight confusion about the directive //go:uintptrkeepalive

2023-11-25 Thread Kwaku Biney
I am working on a project where we make certain syscalls where we pass Go pointers to the syscalls. The syscall we ended up calling is https://cs.opensource.google/go/go/+/refs/tags/go1.21.4:src/syscall/syscall_linux.go;l=65. I think Go 1.21 introduced `runtime.Pinner.pin()` .but we realised it

Re: [go-nuts] Why the extra call to `seed` in this situation?

2023-03-14 Thread Kwaku Biney
Yeah this actually makes sense ``` On Wednesday, March 15, 2023 at 12:11:11 AM UTC Ian Lance Taylor wrote: > On Tue, Mar 14, 2023 at 3:47 PM Kwaku Biney wrote: > > > > i was digging in the rand package and came across NewSource(seed) in the > randpackage which creates a new

[go-nuts] Why the extra call to `seed` in this situation?

2023-03-14 Thread Kwaku Biney
i was digging in the rand package and came across NewSource(seed) in the randpackage which creates a new source in case you don't want the global source set by the package. It returns a Source interface. For some reason, there's a seed method on the Source as well for which Rand implements, whe