Skip to content

Commit

Permalink
Optimize getSharedFormula to avoid runtime.duffcopy (#1837)
Browse files Browse the repository at this point in the history
  • Loading branch information
paolobarbolini committed Mar 3, 2024
1 parent 9d4c2e6 commit 963a058
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cell.go
Original file line number Diff line number Diff line change
Expand Up @@ -1655,8 +1655,10 @@ func parseSharedFormula(dCol, dRow int, orig []byte) (res string, start int) {
// Note that this function not validate ref tag to check the cell whether in
// allow range reference, and always return origin shared formula.
func getSharedFormula(ws *xlsxWorksheet, si int, cell string) string {
for _, r := range ws.SheetData.Row {
for _, c := range r.C {
for row := 0; row < len(ws.SheetData.Row); row++ {
r := &ws.SheetData.Row[row]
for column := 0; column < len(r.C); column++ {
c := &r.C[column]
if c.F != nil && c.F.Ref != "" && c.F.T == STCellFormulaTypeShared && c.F.Si != nil && *c.F.Si == si {
col, row, _ := CellNameToCoordinates(cell)
sharedCol, sharedRow, _ := CellNameToCoordinates(c.R)
Expand Down

0 comments on commit 963a058

Please sign in to comment.