In an opengl project,the following function costs so much time during a frame,is there any way to make a sub array eficiently?
func colorArrayWithParameter(_ parameter:DrawParameter) -> [GLfloat] {
let startIndex = parameter.startIndexShift * 24
let endIndex = (parameter.endIndexShift + 1 ) * 24
let colors = [Float](self.colorBuffer[startIndex..<endIndex])
return colors
}