https://issues.apache.org/bugzilla/show_bug.cgi?id=45376

           Summary: Performance difference between
                    HSSFFormulaEvaluator#evaluateInCell and
                    evaluateFormulaCell
           Product: POI
           Version: 3.0-dev
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


>From Meandron <[EMAIL PROTECTED]> on the mailing list:

I've uploaded a sheet called "Test.xls" 
http://www.nabble.com/file/p18357579/Test.xls Test.xls , which I query using
the following program:

import java.io.FileInputStream;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

public class Test {

        public static void main(String[] args) throws Exception{
                final HSSFWorkbook book = new HSSFWorkbook(new
FileInputStream("c:\\Test.xls"));
                final String SHEET = "Eingabe";
                final int row = 6;
                final HSSFSheet document = book.getSheet(SHEET);

                final HSSFRow excelRow = document.getRow(row);
                for (short i = 4; i < 15; i++) {
                        final HSSFCell excelCell = excelRow.getCell(i);
                        final HSSFFormulaEvaluator evaluator = new
HSSFFormulaEvaluator(book.getSheet(SHEET), book);

                        evaluator.setCurrentRow(excelRow);
                        long now = System.currentTimeMillis();
                        evaluator.evaluate(excelCell);
                        System.out.println("evaluation took: " +
(System.currentTimeMillis() -
now));
                }
        }
}

And here are the results I've received (in millis):

evaluation for cell (6, 4) took: 0
evaluation for cell (6, 5) took: 15
evaluation for cell (6, 6) took: 0
evaluation for cell (6, 7) took: 31
evaluation for cell (6, 8) took: 94
evaluation for cell (6, 9) took: 156
evaluation for cell (6, 10) took: 391
evaluation for cell (6, 11) took: 1406
evaluation for cell (6, 12) took: 5188
evaluation for cell (6, 13) took: 20265
evaluation for cell (6, 14) took: 81766

Perhaps "evaluateInCell" would help me out here, but I think that poi should
be able to evaluate such kind of formulas in an acceptable way.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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]

Reply via email to