Skip to content
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

High memory usage in localMonthNamesXhosa #1455

Closed
nathj07 opened this issue Jan 23, 2023 · 3 comments
Closed

High memory usage in localMonthNamesXhosa #1455

nathj07 opened this issue Jan 23, 2023 · 3 comments
Labels
enhancement New feature or request
Projects

Comments

@nathj07
Copy link
Contributor

nathj07 commented Jan 23, 2023

Description

Whilst reading XLSX files I've noticed large amounts of memory being consumed.
pprof003
pprof004
pprof007
pprof001
pprof002

These pprof SVGs show where the issue appears to be - localMonthsNameXhosa. I have seen it for other local months names too, but Xhosa is the biggest. Sadly I do not have an XLSX file available that will reproduce this issue for you, but hopefully knowing where the high memory usage is ocurring will aid in finding a resolution.

Output of go version:

go version go1.19.4 darwin/amd64

Excelize version or commit ID:

github.com/xuri/excelize/v2 v2.7.0

Environment details (OS, Microsoft Excel™ version, physical, etc.):
This occurs when running in a Docker Container based on RockyLinux: 8.6 with 8G memory and 4vCPU on a K8s cluster

@dankinder
Copy link

Notably, localMonthsNameXhosa is one of the ones that creates new strings via concatenation, where e.g. English doesn't

func localMonthsNameEnglish(t time.Time, abbr int) string {

It would be quite straightforward to refactor these functions to pre-generate the abbreviation variations instead of allocating new strings. It would be good to know if the authors would welcome a PR that does that.

@xuri
Copy link
Member

xuri commented Jan 24, 2023

Thanks for your issue. Contributions are welcome. I'll certainly accept this patch if anybody did that.

@nathj07
Copy link
Contributor Author

nathj07 commented Jan 24, 2023

Let me know if this is not the way you want to go, can totally close this and go a different way. Or I can add to this if there are other funcs that need this treatment.

@xuri xuri added the enhancement New feature or request label Jan 25, 2023
@xuri xuri closed this as completed in 1ab7a99 Jan 25, 2023
@xuri xuri added this to To do in v2.7.1 via automation Jan 26, 2023
@xuri xuri moved this from To do to Performance in v2.7.1 Jan 26, 2023
xuri pushed a commit to JDavidVR/excelize that referenced this issue Jul 11, 2023
…ormat (qax-os#1456)

- Reducing string concatenation and string conversion between rune string data types

Co-authored-by: Nathan Davies <ndavies@turnitin.com>
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
…ormat (qax-os#1456)

- Reducing string concatenation and string conversion between rune string data types

Co-authored-by: Nathan Davies <ndavies@turnitin.com>
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
v2.7.1
Performance
Development

No branches or pull requests

3 participants