Does "for" statement computes the condition expressions at each iteration or only once?
To be more specific is there any performance difference between two examples below:
1.
var slice []int{ ... huge list of items... }
for i:=0; i<len(slice); i++ { .... do something ....}
2.
var slice []int{ ... huge list of items... }
sliceLen := len(slice)
for i:=0; i<sliceLen; i++ { .... do something ....}
Aucun commentaire:
Enregistrer un commentaire