Are large slices more expensive than smaller ones?
Read OriginalThis article clarifies a common misconception in Go programming: assigning a large slice is not more expensive than assigning a small one. It explains that all slices in Go are the same size (three machine words), containing a pointer, length, and capacity. Therefore, copying a slice variable only copies these three words, regardless of the underlying array's size.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser