LIU.JM
Results
1
comments of
LIU.JM
for和range的性能比较的时候,int类型你用的时候是切片,但是struct类型的时候你用的是数组,这样比较是不是不太好?我自己测试的时候,用切片存储int类型或struct类型,for和range测试的结果性能都是差不多的,但是用数组去存储int类型和struct类型的时候,for和range测试的性能是有大差别的 ```go package main import "testing" type Item struct { Id int Val [4096]byte } func BenchmarkForStructArray(b *testing.B) { var items [1024]Item b.ResetTimer() for i := 0; i < 1024;...