3 ms·
Looks pretty cool, however, I'm curious about the usage of a pointer to the key slice. A slice is just two ints and a pointer, so the copy semantics is pretty c
by unsnap_biceps 2y ago
Looks pretty cool, however, I'm curious about the usage of a pointer to the key slice. A slice is just two ints and a pointer, so the copy semantics is pretty cheap, and one less pointer for the GC to clean up later.
Is there some reason why you choose to pass a pointer to the slice?
- silisili 2y agoYou're correct about slice semantics but key here is actually a Go array, not a slice. So it's passing a pointer instead of an entire array.
- unsnap_biceps 2y agoAhh, thank you. Still very new to go :)