You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2017/05/09 16:54:01 UTC

[Bug 60397] very slow Cell Merge for SXSSFWorkbook

https://bz.apache.org/bugzilla/show_bug.cgi?id=60397

Stephen Webster <st...@inetsoft.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #5 from Stephen Webster <st...@inetsoft.com> ---
I have been watching this bug, and wanted to add some information that I have
gathered since I didn't see any progress.  Here is my testcase.

for(int i=0; i < 20000; i++) {
   for(int j=0; j < 30; j+=3) {
      CellRangeAddress range = new CellRangeAddress(i,i,j,j+2);
      sheet.addMergedRegionUnsafe(range);
   }
}

The results get quite a bit worse as the number of rows/merged region number
increases.

1000  rows -> 1.2 seconds
10000 rows -> 100 seconds
20000 rows -> Over 5 minutes.

I dropped the above code and profiled it and turns out the time spent is in the
return statement of addMergedRegion(), ctMergeCells.sizeOfMergeCellArray();

I am not using the return value of this method, after creating a locally
modified version of the XSSFSheet class, I created a method without the return
statement and the testcase finishes in less then 1 second instead of over 5
minutes for 20,000 rows.

Here is the stack from profiler which was 90% of time spent
Stack Trace
org.apache.xmlbeans.impl.store.Locale.count(Xobj, QName, QNameSet)
org.apache.xmlbeans.impl.store.Xobj.count_elements(QName)       
org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTMergeCellsImpl.sizeOfMergeCellArray()
org.apache.poi.xssf.usermodel.XSSFSheet.addMergedRegion(CellRangeAddress,
boolean)
org.apache.poi.xssf.usermodel.XSSFSheet.addMergedRegionUnsafe(CellRangeAddress)

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org