mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
remove append based slice copy patterns that are slower since go1.15 than make+copy
parent
7c21e78798
commit
b120de74c8
@ -11,10 +11,6 @@ a = append(a, b...)
|
|||||||
```go
|
```go
|
||||||
b = make([]T, len(a))
|
b = make([]T, len(a))
|
||||||
copy(b, a)
|
copy(b, a)
|
||||||
// or
|
|
||||||
b = append([]T(nil), a...)
|
|
||||||
// or
|
|
||||||
b = append(a[:0:0], a...) // See https://github.com/go101/go101/wiki
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Cut
|
#### Cut
|
||||||
|
Loading…
x
Reference in New Issue
Block a user