摘要:
package mainimport ( "fmt" "runtime")var slice []intfunc main() { array := make([]int, 0) for i := 0; i < 100; i++ { array = append(array, i) } np := runtime.NumCPU() n := len(array) for i := 0; i < np; i++ { slice := array[i*n/np : (i+1)*n/np] fmt.Println(slice) }}结果其中 for 阅读全文