2 ms·
I'm not sure that I'd agree that `[]byte` in Go is "basically the same as `&[u8]` in Rust; making a `&[u8]` will never cause a heap allocation, which is what I
by saghm 9y ago
I'm not sure that I'd agree that `[]byte` in Go is "basically the same as `&[u8]` in Rust; making a `&[u8]` will never cause a heap allocation, which is what I was trying to get at with my original comment. If I want to track down all of my heap allocations in my program in Rust, I can safely ignore all of my slices, whereas in Go, I have to carefully reason about each usage of one.
- oconnor663 9y agoGot it. In that sense a Go slice and a Go array pointer (a &[n]byte) could have the same effect, is that right? What I wanted to emphasize was that whether you're reading bytes through a Go []byte or a Rust &[u8], the same "number of hops" is happening at runtime.