Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Fixed
-
simple-0.5
-
None
-
None
-
Operating System: Windows
Platform: PC
-
328
Description
Created an attachment (id=536)
Test data for the example code
Given a spreadsheet document which has for example the text alignment or similar formatting set for a whole column (in OpenOffice by selecting the column and then changing the formatting), then reading any cell ranges from that Table using org.odftoolkit.simple.table.Table#getCellRangeByName or org.odftoolkit.simple.table.Table#getCellRangeByPosition becomes unusable in performance.
This is because in the constructor of org.odftoolkit.simple.table.CellRange there is the method call maOwnerTable.getCellCoverInfos(0, 0, maOwnerTable.getColumnCount() - 1, maOwnerTable.getRowCount() - 1) and in this situation maOwnerTable.getRowCount() will return 1048576 (and for formatted rows maOwnerTable.getColumnCount() will return 1024). As a result that method call will take many minutes or hours.
The performance of creating a CellRange should be relative to the size of the range or a constant time operation - not relative to the maximum size of the spreadsheet.
Here is some code to reproduce the issue. I've attached the test.ods file used in the code. On my 3 GHz Core 2 CPU that code takes over an hour to execute - and I haven't even waited until the end.
import org.odftoolkit.simple.SpreadsheetDocument;
import org.odftoolkit.simple.table.*;
public class PerformanceProblem {
public static void main(String[] args) throws Exception
}
Attachments
Attachments
Issue Links
- incorporates
-
ODFTOOLKIT-378 table.getColumnCount() wrong return value
- Open