Bug 56556 - XSSFSheet.setColumnWidth performance issue caused by ColumnHelper.getColumn1Based
Summary: XSSFSheet.setColumnWidth performance issue caused by ColumnHelper.getColumn1B...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.11-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-23 08:51 UTC by fengxx
Modified: 2014-06-05 03:44 UTC (History)
0 users



Attachments
profiler run time (532.54 KB, text/xml)
2014-05-23 16:32 UTC, fengxx
Details
call stack (48.99 KB, image/png)
2014-05-23 16:37 UTC, fengxx
Details

Note You need to log in before you can comment on or make changes to this bug.
Description fengxx 2014-05-23 08:51:06 UTC
It tooks 4-5 minutes for 3K columns.

public class Excel2007ColumnSize extends TestCase {

    int TOTAL_COL = 3000;
    short WDITH = 15 * 255;

    public void testSetColumnSize() {
        Workbook wb = new XSSFWorkbook();
        Sheet st = wb.createSheet();
        Row row = st.createRow(0);
        System.out.println("1: " + System.currentTimeMillis());
        for (int i = 0; i < TOTAL_COL; i++) {
            st.setColumnWidth(i, WDITH);
        }
        System.out.println("2: " + System.currentTimeMillis());
    }
}
Comment 1 Nick Burch 2014-05-23 10:57:46 UTC
Any chance you could use a profiler to work out where the time goes within that ColumnHelper method?
Comment 2 fengxx 2014-05-23 16:32:26 UTC
Created attachment 31656 [details]
profiler run time

poi_runtime.xml
Comment 3 fengxx 2014-05-23 16:34:07 UTC
Comment on attachment 31656 [details]
profiler run time

I am not performance expert, I tried to use netbeans profiler and got the report attached , most time is spend on 
org.apache.xmlbeans.impl.store.Locale.count(org.apache.xmlbeans.impl.store.Xobj, javax.xml.namespace.QName, org.apache.xmlbeans.QNameSet)

org.apache.xmlbeans.impl.store.Xobj.find_element_user(javax.xml.namespace.QName, int)
Comment 4 fengxx 2014-05-23 16:37:58 UTC
Created attachment 31657 [details]
call stack
Comment 5 Nick Burch 2014-06-04 15:58:23 UTC
I've made a change in r1600319, which I think should help. Any chance you could do a build from svn / get a nightly build after that, and see if it has made it better?
Comment 6 fengxx 2014-06-05 03:44:25 UTC
Thanks a lot, it is much better now,the time drops to 2 seconds from 4-5 minutes using the same test case.