himanshuo / gameoflife

The Game of Life
GNU General Public License v2.0
1 stars 0 forks source link

faster iteration over lists for db/task model creation #29

Open himanshuo opened 8 years ago

himanshuo commented 8 years ago

there might be a faster way to handle these lists. Perhaps use a goroutine? Perhaps something else.

The append is adding one by one but as pointers instead of actually copying over. This is efficient. Just make sure of the previous todo though. Read up on it and make more efficient if possible.

Where this is useful: for rows.Next() { var id int var name string //fill id and name rows.Scan(&id, &name) //create model Task curTask := models.Task{Id: id, Name: name} //add model task to list tasks = append(tasks, curTask) }