Iwark / spreadsheet

Google Go (golang) library for reading and writing spreadsheet files on Google Docs.
MIT License
382 stars 53 forks source link

Make it faster #41

Closed Iwark closed 5 years ago

Iwark commented 5 years ago

copy costs when you Update to add rows in a for-range for example.

func (sheet *Sheet) Update(row, column int, val string) {
    if uint(row)+1 > sheet.newMaxRow {
        sheet.newMaxRow = uint(row) + 1
    }
    if uint(column)+1 > sheet.newMaxColumn {
        sheet.newMaxColumn = uint(column) + 1
    }
        //...
        copy(newRows[i], sheet.Rows[i])
}

Here, instead of +1, we can consider adding several rows/columns to reduce copy

or, just add added amount of rows/columns to sheet.Rows/Columns might work instead of copying all the cells