From 0f9170a03b9fe19c1c22687fba8bcbdfd69a6347 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 16 Apr 2019 01:50:16 -0500 Subject: Resolve #382, rewrite prepareSheetXML to scale linearly (#383) * Rewrite prepareSheetXML to scale linearly We don't need to backfill columns into every row for most purposes Provided makeContiguousColumns for setting styles where we do need it for a specific region. Added a benchmark to monitor progress. For 50,000 rows this went from about 11 seconds to 1 second. The improvements are more dramatic as the row/column count increases. * Assigning that row value was redundant --- styles.go | 1 + 1 file changed, 1 insertion(+) (limited to 'styles.go') diff --git a/styles.go b/styles.go index a515756..81d03be 100644 --- a/styles.go +++ b/styles.go @@ -2373,6 +2373,7 @@ func (f *File) SetCellStyle(sheet, hcell, vcell string, styleID int) error { return err } prepareSheetXML(xlsx, vcol, vrow) + makeContiguousColumns(xlsx, hrow, vrow, vcol) for r := hrowIdx; r <= vrowIdx; r++ { for k := hcolIdx; k <= vcolIdx; k++ { -- cgit v1.2.1