https://bz.apache.org/bugzilla/show_bug.cgi?id=58740
Bug ID: 58740
Summary: [PATCH] Fix O(n^2) behavior when generating XLSX files
with large number of styles
Product: POI
Version: 3.13-FINAL
Hardware: PC
OS: Mac OS X 10.1
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
Assignee: [email protected]
Reporter: [email protected]
Created attachment 33352
--> https://bz.apache.org/bugzilla/attachment.cgi?id=33352&action=edit
Patch that fixes the behavior described
When generating XSLX files for a spreadsheet that contains a large number of
cell styles, there is extreme slowness caused by the use of ArrayList.indexOf()
which is O(n) time, leading to overall O(n^2) behavior.
This is easily fixed by keeping a reverse mapping from list entry to list
index. Since the list of styles is only appended to, this is easy.
The attached patch reduced the time to generate my XSLX output from several
minutes to under 10 seconds.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]