Bug 54282

Summary: [PATCH] Fix to speed up opening xslx spreadsheets
Product: POI Reporter: Jan <jan.stette>
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: warwick_burrows
Priority: P2    
Version: 3.9-dev   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: Patch for avoiding repeated calls to size function
Screenshot from profiler session showing bottleneck

Description Jan 2012-12-11 17:52:04 UTC
Created attachment 29744 [details]
Patch for avoiding repeated calls to size function

I'm seeing Apache POI being very slow when opening certain xslx/XSSF spreadsheets. After profiling, it turns out that around half the time was spent calling CTColsImpl.sizeOfColArray() inside ColumnHelper.addCleanColIntoCols(). See the attached screenshot from my profiler session.

The fix is trivially simple, it just pulls the call to sizeOfColArray() outside of the loop. On some spreadsheets, this reduces the time of loading the spreadsheet to half of the original time.
Comment 1 Jan 2012-12-11 17:53:00 UTC
Created attachment 29745 [details]
Screenshot from profiler session showing bottleneck
Comment 2 Nick Burch 2012-12-12 00:48:26 UTC
Thanks for this, committed in r1420501.