Skip to content

Use a faster deepcopy library #2029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Juneezee opened this issue Nov 21, 2024 · 2 comments · Fixed by #2030
Closed

Use a faster deepcopy library #2029

Juneezee opened this issue Nov 21, 2024 · 2 comments · Fixed by #2030
Labels
enhancement New feature or request

Comments

@Juneezee
Copy link
Contributor

Description

We currently use the deepcopy function from https://github.com/mohae/deepcopy to duplicate columns, rows, and worksheets, as shown in the following references:

excelize/col.go

Line 536 in 5f446f2

c := deepcopy.Copy(col).(xlsxCol)

excelize/col.go

Line 554 in 5f446f2

c := deepcopy.Copy(column).(xlsxCol)

rowCopy = deepcopy.Copy(ws.SheetData.Row[i]).(xlsxRow)

cfCopy := deepcopy.Copy(*cf).(xlsxConditionalFormatting)

dvCopy := deepcopy.Copy(*dv).(xlsxDataValidation)

column := deepcopy.Copy(ws.Cols.Col[left]).(xlsxCol)

worksheet := deepcopy.Copy(sheet).(*xlsxWorksheet)

The https://github.com/mohae/deepcopy library has not been updated in 7 years (last commit was September 2017). We should opt for a newer deep copy library.

I suggest we switch to https://github.com/tiendc/go-deepcopy. The benchmarks indicate that it is faster than other popular deep copy libraries.

@xuri xuri closed this as completed Nov 22, 2024
@xuri xuri reopened this Nov 22, 2024
@xuri
Copy link
Member

xuri commented Nov 22, 2024

Thanks for your suggestion. Would you like to create a PR for this?

@Juneezee
Copy link
Contributor Author

Thanks for your suggestion. Would you like to create a PR for this?

@xuri Sure! 😊

@xuri xuri added the enhancement New feature or request label Nov 22, 2024
@xuri xuri closed this as completed in c936188 Nov 22, 2024
@xuri xuri moved this to Performance in Excelize v2.9.1 Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Status: Performance
Development

Successfully merging a pull request may close this issue.

2 participants