poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 53508] Performance XSSFCell.setCellValue(String) is very slow
Date Wed, 04 Jul 2012 10:01:10 GMT

--- Comment #1 from Yegor Kozlov <yegor@dinom.ru> ---
Can you post sample code that compares two methods and demonstrates that
current implementation is slow? 

SharedStringsTable.getKey() can be slow, but I'd like to see a proof. Every
time a string is added to the SST, SharedStringsTable.getKey() computes its
hash code which actually results to invoking xmlBean.toString().hashCode()
where xmlBean is the bean holding the string data. 

Inlining strings has a side effect: it speeds up building of worksheets, but
the resulting file can be much bigger and it will take significantly more time
to open it in Excel.

My idea is to tweak SharedStringsTable.getKey() as follows:

    private String getKey(CTRst st) {
        if(st.sizeOfRArray() == 0) {
            // for plain text return the text value
            return st.getT();
        } else {
            //  for rich text return xml representation of the CTRst bean
            return st.xmlText(options); 

if a string has no rich text runs then we return  its text value, it should be
much faster that invoking st.xmlText(options). 

It would be great if you apply this fix , build POI and meausure the performace


You are receiving this mail because:
You are the assignee for the bug.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message