One ranges a copy of the array, the other does not:
https://play.golang.org/p/Z3InmyFqQN3
On Fri, Aug 16, 2019, 19:11 Vadim Maximov wrote:
> Hi, all!
>
> Is *for.*..*range* over an address/reference of an array faster than
> regular *for...range*? For instance:
>
> arr :=[...]int{1,2,3}
> for
Hi, all!
Is *for.*..*range* over an address/reference of an array faster than
regular *for...range*? For instance:
arr :=[...]int{1,2,3}
for _,v := range {
fmt.Println(v)
}
I heard that it is slightly faster for huge arrays, but why is it so? And
is it actually true (or makes sense)?
--