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

--- Comment #2 from Archie Cobbs <arc...@dellroad.org> ---
(In reply to Javen O'Neal from comment #1)
> Out of curiosity, how many styles are you creating that cause the reported
> several minutes/10 seconds times?

I have one column where the background color is set according to the
data value as a visual aid. Lots of values lead to lots of colors and
therefore styles. Even limiting to couple thousand colors leads to this
problem. 

> 1) higher memory consumption

Yes but insignificantly. A small constant number of bytes per style.

> 2) extra processing power updating multiple data structures

Huh?!? You're missing the whole point.

If you have non-trivial number of styles, there will be MUCH less
processing power utilized because we eliminate the stupid O(n^2) behavior.

For a trivial number of styles, the overhead is minimal - linear time in
the number of styles, which by definition, is small.

> 3) potential for the data structures to get out of sync, especially
> considering projects that subclass POI.

Wrong - the fields are all private. It's not possible for a subclass
to get things out of sync.

> My recommendation is use a single data structure that is a container for
> cell styles, that combines the features that you need that will give fast
> by-index and by-style lookup. If such a data structure isn't available
> off-the-shelf, you may want to write your own. Most trivially, this is just
> a class that contains an ArrayList and a HashMap for inverted array lookups,

That's a possible refinement and I considered it. My goal was to address
the immediate problem.

You are letting the perfect be the enemy of the good. I've provided a
reasonable patch to address what is truly stupid behavior. My recommendation
is to use this patch to "put out the fire" so to speak, and we can refine it
later at a lower priority.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to