# Are large slices more expensive than smaller ones?

DevFeed: [Are large slices more expensive than smaller ones?](<https://devfeed.tech/articles/are-large-slices-more-expensive-than-smaller-ones-20827.md>)

Original publisher: [Read original article](<https://dave.cheney.net/2020/03/01/are-large-slices-more-expensive-than-smaller-ones>)

Author: Dave Cheney

Published: 2020-03-01T05:35:26Z

Content type: article

Language: en

Sources: [Dave Cheney](<https://devfeed.tech/sources/dave-cheney.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [go](<https://devfeed.tech/tags/go.md>), [golang](<https://devfeed.tech/tags/golang.md>), [internals](<https://devfeed.tech/tags/internals.md>), [performance](<https://devfeed.tech/tags/performance.md>), [slices](<https://devfeed.tech/tags/slices.md>)

## AI overview

In Go, assigning a large slice is not more expensive than assigning a smaller slice of the same type. A slice value consists of three machine words--a pointer to its backing array, its length, and its capacity--so assigning a slice copies only those three words, regardless of the amount of data in the backing array.

## Source excerpt

Programmers have a tendency to be superstitious. Particularly, when a programmer hears that copies are expensive, they start to see them everywhere, especially when they learn that, in Go, every assignment is a copy. Consider this code; x is three orders of magnitude larger than y, is the assignment of x to a more expensive [...]