qax-os / excelize

Go language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets
https://xuri.me/excelize
BSD 3-Clause "New" or "Revised" License
18.05k stars 1.71k forks source link

[BUG] fix Get Rows function memory issues #1875

Closed iraj720 closed 5 months ago

iraj720 commented 5 months ago

PR Details

fix Get Rows function memory issues that allocate huge amount of memory in special xlsx files

Description

the problem is discussed in the issue here i just changed it in a way that those empty rows that are located at the end of rows will be ignored

["A", "B", nil, "C", nil, nil] => ["A", "B", nil, "C"]

these nils exist in some special files more than normal for me was 1 million nils

Related Issue

https://github.com/qax-os/excelize/issues/1874

Motivation and Context

it was allocating 30Mb of memory for a 10kb file

How Has This Been Tested

discussed in the issue

Types of changes

Checklist

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.21%. Comparing base (5f8a5b8) to head (e098c3a).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1875 +/- ## ======================================= Coverage 99.21% 99.21% ======================================= Files 32 32 Lines 24067 24069 +2 ======================================= + Hits 23878 23880 +2 Misses 101 101 Partials 88 88 ``` | [Flag](https://app.codecov.io/gh/qax-os/excelize/pull/1875/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=qax-os) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/qax-os/excelize/pull/1875/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=qax-os) | `99.21% <100.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=qax-os#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.