Bug 51635 - [PATCH] Improving performance of XSSFSheet#write
Summary: [PATCH] Improving performance of XSSFSheet#write
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.8-dev
Hardware: PC Linux
: P2 normal with 1 vote (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-08 20:15 UTC by Martin Studer
Modified: 2011-08-10 17:40 UTC (History)
0 users



Attachments
Patch file (599 bytes, application/x-gzip)
2011-08-08 20:15 UTC, Martin Studer
Details
Patch SVN diff (5.66 KB, patch)
2011-08-08 20:15 UTC, Martin Studer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Studer 2011-08-08 20:15:06 UTC
Created attachment 27362 [details]
Patch file

This patch intends to provide improved performance for XSSFSheet#write by getting rid of XSSFSheet#ensureRowOrdering.

The general idea is to keep the underlying CTSheetData row array collection sorted all times (this idea was highlighted by Yegor Kozlov in http://apache-poi.1045710.n5.nabble.com/Performance-Question-with-CTSheetDataImpl-java-td2335065.html). This requires that methods XSSFSheet#createRow, XSSFSheet#removeRow and XSSFSheet#shiftRows manage the worksheet.getSheetData() row array collection correspondingly.

This patch also adapts one of the unit tests:
TestXSSFSheet#testCreateRow

This test was checking that creating rows in reverse order actually keeps the rows inside worksheet.getSheetData() in the order they have been inserted. This has been changed to a test that actually checks that rows are kept in ascending order.
Comment 1 Martin Studer 2011-08-08 20:15:44 UTC
Created attachment 27363 [details]
Patch SVN diff
Comment 2 Yegor Kozlov 2011-08-10 17:40:07 UTC
Applied in r1156272.

P.S. I realized that a similar fix can be applied to XSSFRow which needs to keep cells in sorted order too, see XSSFRow#onDocumentWrite. patches are welcome :)

Regards,
Yegor