poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 55612] Performance improvement (~11% up to ~92%) by adding a cache to HSSFCellStyle.getDataFormatString()
Date Sat, 19 Oct 2013 17:00:57 GMT

--- Comment #2 from Luca Della Toffola <luca.dellatoffola@inf.ethz.ch> ---
(In reply to Yegor Kozlov from comment #1)
> Can you please explain the logic in details?
> Why do you not compare lastFormat and format ? You cache lastFormat  but use
> it only in a "not null" clause and not in equals. 

The main reason to keep all that state is to be on the safe side for the cache
invalidation. Since the cache is static I wanted to store the state of the
"this" object of the previous call. Obviously not all this state is used
directly in the computation of getDataFormatString(),
so there is margin to simplify the patch. 

Regarding the check "_format" is initially initialised to null so I wanted to
keep that case in the invalidation condition.
If both are null then we are fine the two object fields are equal, otherwise if
the format is not null we need to compare the fields to see if the previous
"this" object changed. To have a quick-and-dirty check I packed the fields of
ExtendedFormatRecord into an array.

> Why do you need to cache lastFormatSummary and collection of workbook's
> format records? 

For lastFormatSummary because part of it (one field) is used as parameter for
the call "format.getFormat(...)" in
HSSFCellStyle.getDataFormatString(InternalWorkbook), the remaining array
elements for the reasons explained above. 

For the collection of workbook's format records I wanted to keep them because
they are used in the constructor of HSSFDataFormat created in
HSSFCellStyle.getDataFormatString(InternalWorkbook) so I consider them as
implicit "parameters" of the method getDataFormatString().

I'm preparing a new patch that stores only the collection of workbook's format
records and the value returned by the method HSSFCellStyle.getDataFormat() for
the invalidation.
Results of the performance tests are coming soon.

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