diff options
author | Ted <37789839+Theodoree@users.noreply.github.com> | 2020-11-03 17:48:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-03 17:48:37 +0800 |
commit | fcca8a38389c7a7f99639dc142b9b10c827ac7ce (patch) | |
tree | aa0e2f264153a793f1157c23959a9c140fa1bf67 /xmlWorksheet.go | |
parent | 9d470bb38f992d9f0da2168b7a576f9e212b7a88 (diff) |
optimize memory allocation (#722)
* optimize marshal
* optimize mem alloc
* add benchmark testing
* add NewSheetWithRowNum testing
* sync struct fields order
* add BenchmarkNewSheetWithStreamWriter
* delete NewSheetWithRowNum and benchmark test
Diffstat (limited to 'xmlWorksheet.go')
-rw-r--r-- | xmlWorksheet.go | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/xmlWorksheet.go b/xmlWorksheet.go index 0eaa8ee..8880909 100644 --- a/xmlWorksheet.go +++ b/xmlWorksheet.go @@ -313,20 +313,20 @@ type xlsxSheetData struct { // xlsxRow directly maps the row element. The element expresses information // about an entire row of a worksheet, and contains all cell definitions for a // particular row in the worksheet. -type xlsxRow struct { - Collapsed bool `xml:"collapsed,attr,omitempty"` +type xlsxRow struct { // alignment word + C []xlsxC `xml:"c"` + R int `xml:"r,attr,omitempty"` + Spans string `xml:"spans,attr,omitempty"` + S int `xml:"s,attr,omitempty"` CustomFormat bool `xml:"customFormat,attr,omitempty"` - CustomHeight bool `xml:"customHeight,attr,omitempty"` - Hidden bool `xml:"hidden,attr,omitempty"` Ht float64 `xml:"ht,attr,omitempty"` + Hidden bool `xml:"hidden,attr,omitempty"` + CustomHeight bool `xml:"customHeight,attr,omitempty"` OutlineLevel uint8 `xml:"outlineLevel,attr,omitempty"` - Ph bool `xml:"ph,attr,omitempty"` - R int `xml:"r,attr,omitempty"` - S int `xml:"s,attr,omitempty"` - Spans string `xml:"spans,attr,omitempty"` - ThickBot bool `xml:"thickBot,attr,omitempty"` + Collapsed bool `xml:"collapsed,attr,omitempty"` ThickTop bool `xml:"thickTop,attr,omitempty"` - C []xlsxC `xml:"c"` + ThickBot bool `xml:"thickBot,attr,omitempty"` + Ph bool `xml:"ph,attr,omitempty"` } // xlsxSortState directly maps the sortState element. This collection @@ -456,6 +456,7 @@ type DataValidation struct { // s (Shared String) | Cell containing a shared string. // str (String) | Cell containing a formula string. // +// fixme: how to make this structure smaller; cur size is 152 bytes. it's be too bigger. type xlsxC struct { XMLName xml.Name `xml:"c"` XMLSpace xml.Attr `xml:"space,attr,omitempty"` |