-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 when writing 1million number of rows #876
Comments
Please using the StreamWriter for generating a worksheet with huge amounts of data. Note that the streaming API doesn't support append to the existing worksheets currently. |
Thanks @xuri for suggesting it but still the memory usage is on higher side. |
@viv2793 @xuri I am facing the same issue. When I am trying to write a large amount of data i.e more than a million records, it is taking more than 5 hrs to process. I am not sure about memory usage. Is there any workaround for it? @viv2793 how much time is taking for you to write million of records? |
Hi @rakesh-wrx, thanks for your feedback, could you provide any code and attachments to reproduce this issue? |
Writing 17,000 rows takes about 7 minutes. In my case it's not a high memory thing (it can use more if it'd be faster), but the performance is really slow. I'm trying to give my users an option of having an XLSX file instead of CSV, so I'm used to writing [][]string. I can write the same CSV file in 7 seconds what takes 7 minutes with XLSX. Are there things I can do on the data-generation side before passing into the library that will make it more performant? func writeLineForOutput(line []string, excelLineNum int, lineInterface []interface{}, excelWriter *excelize.StreamWriter) error { |
Hi @mzimmerman, thanks for your feedback, could you provide more details about your environment information, how many columns each row, which version of the Go language and excelize library you are using, what hardware and OS info? Please also reference the performance benchmark report. |
Looks like there's a lot of garbage created/used in referencing the cell addresses... e.g., A10 vs ZZ56 -- it looks like you're converting to/from that a few times depending on where it's needed. Also a lot done in XML serialization. git clone https://github.com/mzimmerman/excelizetest go test -bench=. -cpuprofile cpu.out -memprofile mem.out pprof excelizetest.test cpu.out
|
I'm not sure how to fix/adjust/help the excelize library -- it supports a lot of additional features/functions that I don't want, but that would still be needed to be supported. Because of that, I implemented an XLSX writer of [][]string -- doesn't support any other Excel type but is more performant in large file cases. Uses all cores on a machine but is generally still limited to the flate compression process. https://github.com/mzimmerman/xlsxwriter
|
Hello,
I am facing an issue. I am trying to write large amount of data(approx 1million rows) into the excel and saving the excel at the end after writing all the lines. But the memory usage is very high in the case. It is taking more than 1.5GB of memory. I assume as each row stays in memory and all the data is dumped into the file at the end is causing the issue.
Do we have any method so that we append rows in excel files without taking so much of memory ?
The text was updated successfully, but these errors were encountered: