On Tue, 8 Jul 2008, Meandron wrote:
This worked perfectly fine, and pretty fast, taking less than a second for about 1500 cells, but the forumula are lost in that case. Just now I updated to 3.0.2 final release, to use the new evaluateFormulaCell method. The old code above runs just as fast as before, which is good. But, when I replace the evaluate call and the new value setting above with just one evaluateFormulaCell call, it becomes agonizingly slow after a few cells have been evaluated.
I can't see any reason why this would be the case. The only difference between evaluateFormulaCell and evaluateInCell is that evaluateInCell contains extra calls to cell.setCellType(). So, evaluateFormulaCell actually does less work than evaluateInCell does!
Any chance you could create a small test case, and upload that + your file to bugzilla? Ideally it'd take a boolean, and either call evaluateInCell or evaluateFormulaCell, showing it takes much longer for one than the other. Without that, I can't figure out what's going wrong for you
Reusing the same evaluator does not end up in such long running evaluations though, but on the POI-website it is explicitly mentioned that there would be no great overhead doing this. Well, for me, a 30 seconds gap between reusing a evaluator and not doing that seems to be sort of overhead to me....
The constructor on HSSFFormulaEvaluator does pretty much nothing, so I'm not sure why it'd make any difference. There are a few static fields on HSSFFormulaEvaluator that do hold a cache, I wonder if your classloader is being super eager at throwing those away between each constructor call? Can you try creating one HSSFFormulaEvaluator, saving it somewhere, then creating a new one each time? If that helps the speed, you'll know your class loader / garbage collection is being unhelpful
Nick --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
