# slices

Published articles for slices.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Glitch Effect in Jetpack Compose

DevFeed: [Glitch Effect in Jetpack Compose](<https://devfeed.tech/articles/glitch-effect-in-jetpack-compose-25782.md>)

Original publisher: [Read original article](<https://www.sinasamaki.com/glitch-effect-in-jetpack-compose/>)

Author: sinasamaki

Published: 2025-10-11T08:00:46Z

Content type: tutorial

Language: en

Sources: [sinasamaki](<https://devfeed.tech/sources/sinasamaki.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Compose](<https://devfeed.tech/topics/compose.md>), [Graphics](<https://devfeed.tech/topics/graphics.md>), [GUI](<https://devfeed.tech/topics/gui.md>)

Tags: [animation](<https://devfeed.tech/tags/animation.md>), [article](<https://devfeed.tech/tags/article.md>), [canvas](<https://devfeed.tech/tags/canvas.md>), [compose](<https://devfeed.tech/tags/compose.md>), [graphics](<https://devfeed.tech/tags/graphics.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [mutation](<https://devfeed.tech/tags/mutation.md>), [random](<https://devfeed.tech/tags/random.md>), [scale](<https://devfeed.tech/tags/scale.md>), [slices](<https://devfeed.tech/tags/slices.md>), [translation](<https://devfeed.tech/tags/translation.md>)

### AI overview

A tutorial on implementing a glitch effect in Jetpack Compose by drawing composable content to an offscreen buffer, slicing it horizontally, and applying randomized translations, scaling, color overlays, and timed animation.

### Source excerpt

Easily apply sci-fi, cyberpunk effects on to your app

## 重新思考 Go：Slice 只是「操作视图」

DevFeed: [重新思考 Go：Slice 只是「操作视图」](<https://devfeed.tech/articles/go-slice-40989.md>)

Original publisher: [Read original article](<https://blog.joway.io/posts/golang-rethink-slice/>)

Author: Joway

Published: 2024-03-30T00:00:00Z

Content type: article

Language: zh

Sources: [Random Thoughts](<https://devfeed.tech/sources/random-thoughts.md>)

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

Tags: [copy](<https://devfeed.tech/tags/copy.md>), [gc](<https://devfeed.tech/tags/gc.md>), [go](<https://devfeed.tech/tags/go.md>), [slices](<https://devfeed.tech/tags/slices.md>), [tech](<https://devfeed.tech/tags/tech.md>)

### AI overview

This article examines Go slices as views over underlying memory rather than memory representations. It explains how subslices can retain oversized buffers, pointer elements can remain referenced after removal, and certain allocation patterns can cause unnecessary memory clearing. It concludes by discussing Go 1.21's slices package as a safer way to manipulate slices.

### Source excerpt

重新思考 Go 系列：这个系列希望结合工作中在 Go 编程与性能优化中遇到过的问题，探讨 Go 在语言哲学、底层实现和现实需求三者之间关系与矛盾。 Go 在语法级别上提供了 Slice 类型作为对底层内存的一个「操作视图」: var sh []any // ==> internal struct of []any type SliceHeader struct { Data uintptr Len int Cap int } 编程者可以使用一些近似 Python 的语法来表达对底层内存边界的控制:

## Slices Package: Clip, Clone, and Compact

DevFeed: [Slices Package: Clip, Clone, and Compact](<https://devfeed.tech/articles/slices-package-clip-clone-and-compact-22225.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2023/08/golang-slices-clip-clone-compact.html>)

Published: 2023-08-18T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Library](<https://devfeed.tech/topics/library.md>), [Code](<https://devfeed.tech/topics/code.md>), [SDKs](<https://devfeed.tech/topics/sdks.md>)

Tags: [apis](<https://devfeed.tech/tags/apis.md>), [code](<https://devfeed.tech/tags/code.md>), [go](<https://devfeed.tech/tags/go.md>), [golang](<https://devfeed.tech/tags/golang.md>), [library](<https://devfeed.tech/tags/library.md>), [slices](<https://devfeed.tech/tags/slices.md>), [standard-library](<https://devfeed.tech/tags/standard-library.md>)

### AI overview

This tutorial explains how the Go slices package APIs Clip, Clone, and Compact work. It shows how Clip reduces a slice's capacity to its length and describes Clone as a shallow copy of the backing-array elements.

### Source excerpt

Series Here are all the posts in this series about the slices package. Binary Search Clip, Clone, and Compact Compare Contains, Delete, and Equal Introduction In the first post of this series, I discussed the binary search API from the slices package that is now part of the standard library with the release of version 1.21. In this post, I will share how the Clip, Clone, and Compact APIs work. Clip The Clip API can be used to remove unused capacity from a slice. This means reducing the capacity of the slice to match its length.

## Collection like objects in python

DevFeed: [Collection like objects in python](<https://devfeed.tech/articles/collection-like-objects-in-python-27328.md>)

Original publisher: [Read original article](<https://blog.pchudzik.com/202004/python-and-collection-like-objects/>)

Published: 2020-04-15T00:00:00Z

Content type: tutorial

Language: en

Sources: [Paweł Chudzik](<https://devfeed.tech/sources/pawe-chudzik.md>)

Topics: [Python](<https://devfeed.tech/topics/python.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Protocol (disambiguation)](<https://devfeed.tech/topics/protocol.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [behavior](<https://devfeed.tech/tags/behavior.md>), [class](<https://devfeed.tech/tags/class.md>), [collections](<https://devfeed.tech/tags/collections.md>), [dsl](<https://devfeed.tech/tags/dsl.md>), [functional](<https://devfeed.tech/tags/functional.md>), [list](<https://devfeed.tech/tags/list.md>), [programming-language](<https://devfeed.tech/tags/programming-language.md>), [protocol](<https://devfeed.tech/tags/protocol.md>), [python](<https://devfeed.tech/tags/python.md>), [set](<https://devfeed.tech/tags/set.md>), [slices](<https://devfeed.tech/tags/slices.md>)

### AI overview

A tutorial on implementing Python collection-like objects using the collections protocol. It discusses slices and methods such as __getitem__, __setitem__, __delitem__, __iter__, __contains__, and __missing__, including how they support collection behavior and domain-specific language extensions.

### Source excerpt

Collections are an important part of every programming language. In python, there is a couple of built-in collections like list, set, dictionary but I'm not going to dig into them now. In this post, I'll explore what it takes to implement collection like objects on your own using collections protocol. Read more

## 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 [...]

## A Closer look at Slices on Android

DevFeed: [A Closer look at Slices on Android](<https://devfeed.tech/articles/a-closer-look-at-slices-on-android-25649.md>)

Original publisher: [Read original article](<https://adambennett.dev/2018/05/a-closer-look-at-slices-on-android/>)

Published: 2018-05-31T13:11:02Z

Content type: tutorial

Language: en

Sources: [Posts on Adam Bennett](<https://devfeed.tech/sources/posts-on-adam-bennett.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [SDK](<https://devfeed.tech/topics/sdk.md>), [Google](<https://devfeed.tech/topics/google.md>), [App](<https://devfeed.tech/topics/app.md>), [Framework](<https://devfeed.tech/topics/framework.md>)

Tags: [algorithms](<https://devfeed.tech/tags/algorithms.md>), [android](<https://devfeed.tech/tags/android.md>), [app](<https://devfeed.tech/tags/app.md>), [blog](<https://devfeed.tech/tags/blog.md>), [career](<https://devfeed.tech/tags/career.md>), [compose](<https://devfeed.tech/tags/compose.md>), [developer-preview](<https://devfeed.tech/tags/developer-preview.md>), [development](<https://devfeed.tech/tags/development.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [finance](<https://devfeed.tech/tags/finance.md>), [functional](<https://devfeed.tech/tags/functional.md>), [google](<https://devfeed.tech/tags/google.md>), [google-assistant](<https://devfeed.tech/tags/google-assistant.md>), [google-io](<https://devfeed.tech/tags/google-io.md>), [growth](<https://devfeed.tech/tags/growth.md>), [java](<https://devfeed.tech/tags/java.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [money](<https://devfeed.tech/tags/money.md>), [opinions](<https://devfeed.tech/tags/opinions.md>), [play-store](<https://devfeed.tech/tags/play-store.md>), [sdk](<https://devfeed.tech/tags/sdk.md>), [search](<https://devfeed.tech/tags/search.md>), [slices](<https://devfeed.tech/tags/slices.md>), [software](<https://devfeed.tech/tags/software.md>), [startups](<https://devfeed.tech/tags/startups.md>), [thoughts](<https://devfeed.tech/tags/thoughts.md>), [training](<https://devfeed.tech/tags/training.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>)

### AI overview

This article examines Android Slices introduced around the Android P Alpha release and explains their relationship to App Actions. It describes how App Actions can connect apps with Google Assistant, Search, and the Play Store, using recognized user intents and app deep links to support queries such as cryptocurrency price requests.

### Source excerpt

In the lead-up to Google IO 2018 and after peering into the Android P Alpha release, some people noticed a mysterious new "Slices" class within the P SDK docs. There was a lot of speculation as to what Slices actually did, and Sebastiano Poggi at Novoda did a great deep-dive into what was known at the time.

## Go: Slice search vs map lookup

DevFeed: [Go: Slice search vs map lookup](<https://devfeed.tech/articles/go-slice-search-vs-map-lookup-35405.md>)

Original publisher: [Read original article](<https://darkcoding.net/software/go-slice-search-vs-map-lookup/>)

Author: Graham King

Published: 2015-06-30T06:09:24Z

Content type: article

Language: en

Sources: [Graham King](<https://devfeed.tech/sources/graham-king.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>), [Benchmark](<https://devfeed.tech/topics/benchmark.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [benchmark](<https://devfeed.tech/tags/benchmark.md>), [code](<https://devfeed.tech/tags/code.md>), [data-structure](<https://devfeed.tech/tags/data-structure.md>), [go](<https://devfeed.tech/tags/go.md>), [performance](<https://devfeed.tech/tags/performance.md>), [results](<https://devfeed.tech/tags/results.md>), [slices](<https://devfeed.tech/tags/slices.md>), [software](<https://devfeed.tech/tags/software.md>)

### AI overview

A comparison of Go map lookups and slice searches finds that slices can be faster for very small collections: up to about five items for key-value lookups and ten items for integer-set lookups. Maps are generally the straightforward choice beyond those break-even points.

### Source excerpt

Maps vs. slices: Choose wisely for optimal performance.

## L3 cache mapping on Sandy Bridge CPUs

DevFeed: [L3 cache mapping on Sandy Bridge CPUs](<https://devfeed.tech/articles/l3-cache-mapping-on-sandy-bridge-cpus-21570.md>)

Original publisher: [Read original article](<http://lackingrhoticity.blogspot.com/2015/04/l3-cache-mapping-on-sandy-bridge-cpus.html>)

Author: Mark Seaborn (noreply@blogger.com)

Published: 2015-04-27T21:59:00Z

Content type: article

Language: en

Sources: [Mark Seaborn](<https://devfeed.tech/sources/mark-seaborn.md>)

Topics: [Cache](<https://devfeed.tech/topics/cache.md>), [cpu](<https://devfeed.tech/topics/cpu.md>), [intel](<https://devfeed.tech/topics/intel.md>), [systems](<https://devfeed.tech/topics/systems.md>)

Tags: [cache](<https://devfeed.tech/tags/cache.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [hash](<https://devfeed.tech/tags/hash.md>), [intel](<https://devfeed.tech/tags/intel.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [memory](<https://devfeed.tech/tags/memory.md>), [paper](<https://devfeed.tech/tags/paper.md>), [protocol](<https://devfeed.tech/tags/protocol.md>), [rowhammer](<https://devfeed.tech/tags/rowhammer.md>), [side-channel](<https://devfeed.tech/tags/side-channel.md>), [slices](<https://devfeed.tech/tags/slices.md>), [xor](<https://devfeed.tech/tags/xor.md>)

### AI overview

The article explains how physical addresses map to cache sets and slices in the L3 cache of Intel Sandy Bridge CPUs. It reports a previously published mapping for four-core CPUs and presents the author's mapping for two-core CPUs, with applications to kernel ASLR analysis and row-hammering research.

### Source excerpt

In 2013, some researchers reverse-engineered how Intel Sandy Bridge CPUs map physical addresses to cache sets in the L3 cache (the last-level cache). They were interested in the cache mapping because it can be used to defeat kernel ASLR. I'm interested because the cache mapping can be used to test whether cached memory accesses can do row hammering (which can cause exploitable bit flips in some DRAM devices). The researchers published the details in the paper "Practical Timing Side Channel Attacks Against Kernel Space ASLR" (Ralf Hund, Carsten Willems and Thorsten Holz). They only published the mapping for 4-core CPUs, but I have figured out the mapping for 2-core CPUs as well. Some background: On Sandy Bridge CPUs, the L3 cache is divided into slices. Physical addresses are hashed to determine which slice of the L3 cache they will be stored in. The L3 cache is distributed and ring-based. There is one slice per core, but all the cores in a CPU can access all the cache slices via a ring bus which connects all the cores and their caches together. When a core accesses a memory location, the location will be slightly slower to access if it maps to a different core's cache slice, because it would take one or two hops around the ring bus to access it. The protocol used on the ring bus is based on QPI (Intel's QuickPath Interconnect). (QPI is a protocol used for connecting multiple CPUs together on high-end multi-socket systems.) Each cache slice contains 2048 cache sets. On lower-end CPUs, cache sets are 12-way associative, so a cache slice is 1.5MB in size (2048 sets * 12 ways * 64 bytes per cache line = 1.5MB). On higher-end CPUs, cache sets are 16-way associative, so a cache slice is 2MB in size (2048 sets * 16 ways * 64 bytes per cache line = 2MB). Cache mapping The researchers (Hund et al) figured out that the L3 cache uses the bits of a physical address as follows: Bits 0-5: These give the 6-bit byte offset within a 64-byte cache line. Bits 6-16: These give the 11-b

## Three-Index Slices in Go 1.2

DevFeed: [Three-Index Slices in Go 1.2](<https://devfeed.tech/articles/three-index-slices-in-go-1-2-22090.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2013/12/three-index-slices-in-go-12.html>)

Published: 2013-12-17T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

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

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [blog](<https://devfeed.tech/tags/blog.md>), [capacity](<https://devfeed.tech/tags/capacity.md>), [code](<https://devfeed.tech/tags/code.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [index](<https://devfeed.tech/tags/index.md>), [programming](<https://devfeed.tech/tags/programming.md>), [slices](<https://devfeed.tech/tags/slices.md>)

### AI overview

This tutorial explains the three-index slice feature introduced in Go 1.2. It shows how restricting a slice's capacity provides more control over append operations and protects the underlying array from unintended access.

### Source excerpt

With the release of Go 1.2, slices gained the ability to specify the capacity when performing a slicing operation. This doesn't mean we can use this index to extend the capacity of the underlying array. It means we can create a new slice whose capacity is restricted. Restricting the capacity provides a level of protection to the underlying array and gives us more control over append operations. Here are the release notes and design document for the feature request: External resource on tip.golang.org: http://tip.golang.org/doc/go1.2#three_index External resource on docs.google.com: https://docs.google.com/document/d/1GKKdiGYAghXRxC2BFrSEbHBZZgAGKQ-yXK-hRKBo0Kk/pub Let's write some code to explore using the new capacity index. As with all my slice posts, I am going to use this InspectSlice function:

## Go: How slices grow

DevFeed: [Go: How slices grow](<https://devfeed.tech/articles/go-how-slices-grow-35403.md>)

Original publisher: [Read original article](<https://darkcoding.net/software/go-how-slices-grow/>)

Author: Graham King

Published: 2013-12-12T04:49:00Z

Content type: tutorial

Language: en

Sources: [Graham King](<https://devfeed.tech/sources/graham-king.md>)

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

Tags: [array](<https://devfeed.tech/tags/array.md>), [capacity](<https://devfeed.tech/tags/capacity.md>), [garbage-collection](<https://devfeed.tech/tags/garbage-collection.md>), [go](<https://devfeed.tech/tags/go.md>), [growth](<https://devfeed.tech/tags/growth.md>), [make](<https://devfeed.tech/tags/make.md>), [memory](<https://devfeed.tech/tags/memory.md>), [slices](<https://devfeed.tech/tags/slices.md>), [software](<https://devfeed.tech/tags/software.md>)

### AI overview

This article explains how Go slices grow when append exceeds the backing array's capacity. It states that slices double in size up to 1024 elements, then grow by 25% per allocation, while noting that this is an implementation detail that may change. It recommends preallocating capacity when the approximate size is known to reduce allocations, copying, and garbage collection.

### Source excerpt

Uncover the hidden growth patterns of Go slices.

## Iterating Over Slices In Go

DevFeed: [Iterating Over Slices In Go](<https://devfeed.tech/articles/iterating-over-slices-in-go-22071.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2013/09/iterating-over-slices-in-go.html>)

Published: 2013-09-23T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

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

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [blog](<https://devfeed.tech/tags/blog.md>), [code](<https://devfeed.tech/tags/code.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [programming](<https://devfeed.tech/tags/programming.md>), [slices](<https://devfeed.tech/tags/slices.md>)

### AI overview

A tutorial on iterating over slices in Go. The supplied text introduces slices as collections used for data and discusses Go's imperative, pass-by-value model, including how pointers can affect memory use, performance, and synchronization.

### Source excerpt

Slices are used everywhere in my code. If I am working with data from MongoDB, it is stored in a slice. If I need to keep track of a collection of problems after running an operation, it is stored in a slice. If you don't understand how slices work yet or have been avoiding them like I did when I started, read these two posts to learn more. External resource on ardanlabs.com: https://www.ardanlabs.com/blog/2013/08/understanding-slices-in-go-programming.html External resource on ardanlabs.com: https://www.ardanlabs.com/blog/2013/08/collections-of-unknown-length-in-go.html

## Slices of Slices of Slices in Go

DevFeed: [Slices of Slices of Slices in Go](<https://devfeed.tech/articles/slices-of-slices-of-slices-in-go-22075.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2013/09/slices-of-slices-of-slices-in-go.html>)

Published: 2013-09-10T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

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

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [blog](<https://devfeed.tech/tags/blog.md>), [code](<https://devfeed.tech/tags/code.md>), [data-structure](<https://devfeed.tech/tags/data-structure.md>), [geospatial](<https://devfeed.tech/tags/geospatial.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [mongodb](<https://devfeed.tech/tags/mongodb.md>), [programming](<https://devfeed.tech/tags/programming.md>), [slices](<https://devfeed.tech/tags/slices.md>)

### AI overview

This tutorial explains how to model nested Go slices for storing marine forecast polygons in MongoDB. It defines polygon, polygon-ring, and marine-station structures, including the nested coordinate representation required for MongoDB geospatial searches.

### Source excerpt

I am working on building code to load polygons for the different Marine Forecast areas in the United States. These polygons need to be stored in MongoDB and there is a special way that needs to be done. It would not have been a big deal if it wasn't for this fact. There isn't just one polygon for each area. There is an external polygon and then zero to many interior polygons that need to be stored in relationship. After staring at the problem for a bit I realized that I needed to create a slice of Marine Forecast areas, each of which contained a slice of polygons. To store each polygon ring I needed a slice of geographic coordinates. Finally each coordinate needed to be stored in a two dimensional array of floats. A picture is worth a thousand words:

## Collections Of Unknown Length in Go

DevFeed: [Collections Of Unknown Length in Go](<https://devfeed.tech/articles/collections-of-unknown-length-in-go-22063.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2013/08/collections-of-unknown-length-in-go.html>)

Published: 2013-08-26T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

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

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [article](<https://devfeed.tech/tags/article.md>), [blog](<https://devfeed.tech/tags/blog.md>), [collections](<https://devfeed.tech/tags/collections.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [programming](<https://devfeed.tech/tags/programming.md>), [programming-language](<https://devfeed.tech/tags/programming-language.md>), [slices](<https://devfeed.tech/tags/slices.md>)

### AI overview

This article explains how to use Go slices for collections whose length is unknown. It concludes that slices are generally preferable to linked lists in practical cases, while noting considerations such as shared underlying arrays and related performance edge cases.

### Source excerpt

If you are coming to Go after using a programming language like C# or Java, the first thing you will discover is that there are no traditional collection types like List and Dictionary. That really threw me off for months. I found a package called container/list and gravitated to using it for almost everything. Something in the back of my head kept nagging me. It didn't make any sense that the language designers would not directly support managing a collection of unknown length. Everyone talks about how slices are widely used in the language and here I am only using them when I have a well defined capacity or they are returned to me by some function. Something is wrong!! So I wrote an article earlier in the month that took the covers off of slices in a hope that I would find some magic that I was missing. I now know how slices work but at the end of the day, I still had an array that would have to grow. I was taught in school that linked lists were more efficient and gave you a better way to store large collections of data. Especially when the number of items you need to collect is unknown. It made sense to me. When I thought about using an empty slice, I had this very WRONG picture in my head:

## Understanding Slices in Go Programming

DevFeed: [Understanding Slices in Go Programming](<https://devfeed.tech/articles/understanding-slices-in-go-programming-22066.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2013/08/understanding-slices-in-go-programming.html>)

Published: 2013-08-15T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

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

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [blog](<https://devfeed.tech/tags/blog.md>), [capacity](<https://devfeed.tech/tags/capacity.md>), [data-structure](<https://devfeed.tech/tags/data-structure.md>), [function](<https://devfeed.tech/tags/function.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [make](<https://devfeed.tech/tags/make.md>), [programming](<https://devfeed.tech/tags/programming.md>), [slices](<https://devfeed.tech/tags/slices.md>)

### AI overview

A tutorial explaining Go slices, including their internal structure, relationship to underlying arrays, length and capacity, creation with make and slice literals, and copying when capacity must change.

### Source excerpt

Since I started programming in Go the concept and use of slices has been confusing. This is something completely new to me. They look like an array, and feel like an array, but they are much more than an array. I am constantly reading how slices are used quite a bit by Go programmers and I think it is finally time for me to understand what slices are all about.