mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Optimize: file /cpuset slice make cap (#112270)
This commit is contained in:
parent
5bcdc82911
commit
759e043136
@ -191,7 +191,7 @@ func (s CPUSet) Difference(s2 CPUSet) CPUSet {
|
|||||||
// ToSlice returns a slice of integers that contains all elements from
|
// ToSlice returns a slice of integers that contains all elements from
|
||||||
// this set.
|
// this set.
|
||||||
func (s CPUSet) ToSlice() []int {
|
func (s CPUSet) ToSlice() []int {
|
||||||
result := []int{}
|
result := make([]int, 0, len(s.elems))
|
||||||
for cpu := range s.elems {
|
for cpu := range s.elems {
|
||||||
result = append(result, cpu)
|
result = append(result, cpu)
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ func (s CPUSet) ToSlice() []int {
|
|||||||
// ToSliceNoSort returns a slice of integers that contains all elements from
|
// ToSliceNoSort returns a slice of integers that contains all elements from
|
||||||
// this set.
|
// this set.
|
||||||
func (s CPUSet) ToSliceNoSort() []int {
|
func (s CPUSet) ToSliceNoSort() []int {
|
||||||
result := []int{}
|
result := make([]int, 0, len(s.elems))
|
||||||
for cpu := range s.elems {
|
for cpu := range s.elems {
|
||||||
result = append(result, cpu)
|
result = append(result, cpu)
|
||||||
}
|
}
|
||||||
@ -212,7 +212,7 @@ func (s CPUSet) ToSliceNoSort() []int {
|
|||||||
// ToSliceInt64 returns an ordered slice of int64 that contains all elements from
|
// ToSliceInt64 returns an ordered slice of int64 that contains all elements from
|
||||||
// this set
|
// this set
|
||||||
func (s CPUSet) ToSliceInt64() []int64 {
|
func (s CPUSet) ToSliceInt64() []int64 {
|
||||||
var result []int64
|
result := make([]int64, 0, len(s.elems))
|
||||||
for cpu := range s.elems {
|
for cpu := range s.elems {
|
||||||
result = append(result, int64(cpu))
|
result = append(result, int64(cpu))
|
||||||
}
|
}
|
||||||
@ -223,7 +223,7 @@ func (s CPUSet) ToSliceInt64() []int64 {
|
|||||||
// ToSliceNoSortInt64 returns a slice of int64 that contains all elements from
|
// ToSliceNoSortInt64 returns a slice of int64 that contains all elements from
|
||||||
// this set.
|
// this set.
|
||||||
func (s CPUSet) ToSliceNoSortInt64() []int64 {
|
func (s CPUSet) ToSliceNoSortInt64() []int64 {
|
||||||
var result []int64
|
result := make([]int64, 0, len(s.elems))
|
||||||
for cpu := range s.elems {
|
for cpu := range s.elems {
|
||||||
result = append(result, int64(cpu))
|
result = append(result, int64(cpu))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user