You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2016/01/20 06:11:44 UTC

[Bug 58896] autoSizeColumn() is too slow

https://bz.apache.org/bugzilla/show_bug.cgi?id=58896

--- Comment #1 from Javen O'Neal <on...@apache.org> ---
I've looked through the code 6 months back because I had the same observation.

My conclusion was that nothing stood out as wastefully inefficient. The
contents of every cell (formulas evaluated as necessary) in a column was
rendered in RichText, and a minimum bounding box around the RichText was
calculated. This was done exactly once per non-blank cell in the column.

To make this faster, while auto-sizing a column, we could cache cells with the
same value and formatting to avoid re-calculating the RichText box, but this
comes at the cost of memory and a slight performance hit when the majority of
cell values in a column are unique. Alternatively, the workbook could cache the
column widths when cell values are modified, which would result in a net
increase in memory consumption and time, and changing any formula would
invalidate the calculated column widths. Excel could get away with the latter
approach since the marginal cost to auto-sizing one cell is negligible when
using a GUI. However, I don't know if this is what Excel does.

Feel free to step through the autosize code yourself to see if you can find
something I couldn't. More eyes are better.

-- 
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