diff options
author | Harris <mike.harris@cerner.com> | 2019-08-04 17:23:42 -0500 |
---|---|---|
committer | Harris <mike.harris@cerner.com> | 2019-08-05 08:50:45 -0500 |
commit | ac91ca0ded4111ed9f22578d4a0570a9084c97b0 (patch) | |
tree | 699c004cf622bafebadbc1fae5e59618ae0a8dfc /rows_test.go | |
parent | cbe919fdf6c00733513494680b89171b8b1b41a1 (diff) |
Only parse xml once when reading
We were parsing the whole sheet twice since the
sheet reader already reads in all the rows.
getTotalRowsCols function is unused after these changes
so it has been deleted as well.
Closes #439
Diffstat (limited to 'rows_test.go')
-rw-r--r-- | rows_test.go | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/rows_test.go b/rows_test.go index f7d49b4..d52c635 100644 --- a/rows_test.go +++ b/rows_test.go @@ -39,9 +39,6 @@ func TestRows(t *testing.T) { if !assert.Equal(t, collectedRows, returnedRows) { t.FailNow() } - - r := Rows{} - r.Columns() } func TestRowsError(t *testing.T) { @@ -672,6 +669,21 @@ func TestDuplicateRowInvalidRownum(t *testing.T) { } } +func BenchmarkRows(b *testing.B) { + for i := 0; i < b.N; i++ { + f, _ := OpenFile(filepath.Join("test", "Book1.xlsx")) + rows, _ := f.Rows("Sheet2") + for rows.Next() { + row, _ := rows.Columns() + for i := range row { + if i >= 0 { + continue + } + } + } + } +} + func trimSliceSpace(s []string) []string { for { if len(s) > 0 && s[len(s)-1] == "" { |