From: Nick Burch Date: Sun, 10 Jun 2012 20:40:32 +0000 (+0000) Subject: Update the FormulaEvaluator performance section to match current behaviour X-Git-Tag: 3.10-beta1~187 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e06949f47da96d8b2607973e73806b4ff986e185;p=poi.git Update the FormulaEvaluator performance section to match current behaviour git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1348657 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/documentation/content/xdocs/spreadsheet/eval.xml b/src/documentation/content/xdocs/spreadsheet/eval.xml index 0eb54411a9..5ff76effb5 100644 --- a/src/documentation/content/xdocs/spreadsheet/eval.xml +++ b/src/documentation/content/xdocs/spreadsheet/eval.xml @@ -272,28 +272,41 @@ for(int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++) { - -
Performance Notes -
    -
  • Generally you should have to create only one FormulaEvaluator - instance per sheet, but there really is no overhead in creating - multiple FormulaEvaluators per sheet other than that of the - FormulaEvaluator object creation. -
  • -
  • Also note that FormulaEvaluator maintains a reference to - the sheet and workbook, so ensure that the evaluator instance - is available for garbage collection when you are done with it - (in other words don't maintain long lived reference to - FormulaEvaluator if you don't really need to - unless - all references to the sheet and workbook are removed, these - don't get garbage collected and continue to occupy potentially - large amounts of memory). -
  • -
  • CellValue instances however do not maintain reference to the - Cell or the sheet or workbook, so these can be long-lived - objects without any adverse effect on performance. -
  • -
-
- + +
Performance Notes +
    +
  • Generally you should have to create only one FormulaEvaluator + instance per Workbook. The FormulaEvaluator will cache + evaluations of dependent cells, so if you have multiple + formulas all depending on a cell then subsequent evaluations + will be faster. +
  • +
  • You should normally perform all of your updates to cells, + before triggering the evaluation, rather than doing one + cell at a time. By waiting until all the updates/sets are + performed, you'll be able to take best advantage of the caching + for complex formulas. +
  • +
  • If you do end up making changes to cells part way through + evaluation, you should call notifySetFormula or + notifyUpdateCell to trigger suitable cache clearance. + Alternately, you could instantiate a new FormulaEvaluator, + which will start with empty caches. +
  • +
  • Also note that FormulaEvaluator maintains a reference to + the sheet and workbook, so ensure that the evaluator instance + is available for garbage collection when you are done with it + (in other words don't maintain long lived reference to + FormulaEvaluator if you don't really need to - unless + all references to the sheet and workbook are removed, these + don't get garbage collected and continue to occupy potentially + large amounts of memory). +
  • +
  • CellValue instances however do not maintain reference to the + Cell or the sheet or workbook, so these can be long-lived + objects without any adverse effect on performance. +
  • +
+
+