Appending to slice bad performance.. why?
问题 I'm currently creating a game using GoLang. I'm measuring the FPS. I'm noticing about a 7 fps loss using a for loop to append to a slice like so: vertexInfo := Opengl.OpenGLVertexInfo{} for i := 0; i < 4; i = i + 1 { vertexInfo.Translations = append(vertexInfo.Translations, float32(s.x), float32(s.y), 0) vertexInfo.Rotations = append(vertexInfo.Rotations, 0, 0, 1, s.rot) vertexInfo.Scales = append(vertexInfo.Scales, s.xS, s.yS, 0) vertexInfo.Colors = append(vertexInfo.Colors, s.r, s.g, s.b, s