# Improving 'container/list'

DevFeed: [Improving 'container/list'](<https://devfeed.tech/articles/improving-container-list-38933.md>)

Original publisher: [Read original article](<https://idea.popcount.org/2014-02-28-improving-containerlist>)

Author: Marek

Published: 2014-02-27T23:00:00Z

Content type: article

Language: en

Sources: [Marek Majkowski](<https://devfeed.tech/sources/marek-majkowski.md>)

Topics: [Data structures](<https://devfeed.tech/topics/data-structures.md>), [implementation](<https://devfeed.tech/topics/implementation.md>), [structure](<https://devfeed.tech/topics/structure.md>), [interface](<https://devfeed.tech/topics/interface.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [container](<https://devfeed.tech/tags/container.md>), [data-structure](<https://devfeed.tech/tags/data-structure.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [interface](<https://devfeed.tech/tags/interface.md>), [linux-kernel](<https://devfeed.tech/tags/linux-kernel.md>), [list](<https://devfeed.tech/tags/list.md>), [memory](<https://devfeed.tech/tags/memory.md>)

## AI overview

The article examines how Go's container/list uses an external linked-list representation that allocates a separate list element for each item. It compares this with an internal representation and describes simpler ways to adapt the standard implementation to avoid the additional allocation, while noting the tradeoff in memory usage and encapsulation.

## Source excerpt

Improving 'container/list' Golang ships with a linked list1 data structure: . The implementation is great and simple but it suffers an interesting problem: adding a value to a list requires a memory allocation. Let me explain. Broadly speaking a linked list can be implemented in one of two ways: - The list can hold a reference to the item. Let's call that an "external" implementation. The item ("Alice von Wonderland" in our example) doesn't have any knowledge of the list.