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
This commit is contained in:
parent
99fcaf0edb
commit
c7fd6d3212
@ -272,28 +272,41 @@ for(int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++) {
|
|||||||
</source>
|
</source>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<anchor id="Performance"/>
|
<anchor id="Performance"/>
|
||||||
<section><title>Performance Notes</title>
|
<section><title>Performance Notes</title>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Generally you should have to create only one FormulaEvaluator
|
<li>Generally you should have to create only one FormulaEvaluator
|
||||||
instance per sheet, but there really is no overhead in creating
|
instance per Workbook. The FormulaEvaluator will cache
|
||||||
multiple FormulaEvaluators per sheet other than that of the
|
evaluations of dependent cells, so if you have multiple
|
||||||
FormulaEvaluator object creation.
|
formulas all depending on a cell then subsequent evaluations
|
||||||
</li>
|
will be faster.
|
||||||
<li>Also note that FormulaEvaluator maintains a reference to
|
</li>
|
||||||
the sheet and workbook, so ensure that the evaluator instance
|
<li>You should normally perform all of your updates to cells,
|
||||||
is available for garbage collection when you are done with it
|
before triggering the evaluation, rather than doing one
|
||||||
(in other words don't maintain long lived reference to
|
cell at a time. By waiting until all the updates/sets are
|
||||||
FormulaEvaluator if you don't really need to - unless
|
performed, you'll be able to take best advantage of the caching
|
||||||
all references to the sheet and workbook are removed, these
|
for complex formulas.
|
||||||
don't get garbage collected and continue to occupy potentially
|
</li>
|
||||||
large amounts of memory).
|
<li>If you do end up making changes to cells part way through
|
||||||
</li>
|
evaluation, you should call <em>notifySetFormula</em> or
|
||||||
<li>CellValue instances however do not maintain reference to the
|
<em>notifyUpdateCell</em> to trigger suitable cache clearance.
|
||||||
Cell or the sheet or workbook, so these can be long-lived
|
Alternately, you could instantiate a new FormulaEvaluator,
|
||||||
objects without any adverse effect on performance.
|
which will start with empty caches.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
<li>Also note that FormulaEvaluator maintains a reference to
|
||||||
</section>
|
the sheet and workbook, so ensure that the evaluator instance
|
||||||
</body>
|
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).
|
||||||
|
</li>
|
||||||
|
<li>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.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
</body>
|
||||||
</document>
|
</document>
|
||||||
|
Loading…
Reference in New Issue
Block a user