We do have map based cache in standard and extended charset provider
implementation already. The standard version is prehashedmap based, it
probably should be fast enough. The extended version is a treemap based,
which probably is slow.

I'm a little surprised that the 2-elements cache in Charset actually makes
big difference for the prehashedmap based cache in standard charsets
provider.

Yes, we don't cache the non-builtin provider.  It might trigger performance
hit if certain number of charsets from that provider is frequently looked up.

-Sherman

On 01/12/2015 02:41 PM, Martin Buchholz wrote:
I don't disagree about 3 elements in the cache being better than 2.
When I implemented this crappy cache, it was all about "2 is better than 1".
Yeah, maybe we could get a "real" cache someday...

On Mon, Jan 12, 2015 at 1:26 PM, Ulf Zibis<ulf.zi...@gmx.de>  wrote:

Am 12.01.2015 um 20:42 schrieb Martin Buchholz:

Historical notes:

I added the two-element cache many years ago, assuming that code that
repeatedly accessed more than 2 charsets would be rare.

I suspect this opinion, see: http://bugs.java.com/
bugdatabase/view_bug.do?bug_id=6795535

-Ulf



Reply via email to