xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Finn Bock <bck...@worldonline.dk>
Subject Re: String.intern() test and measurement
Date Tue, 02 Dec 2003 22:10:20 GMT
[John Austin]

> I wondered how much chaining there has to be before performance
> gets really bad when I checked your program more closely. Your 
> example program would produce external chains of length:
> 2000000/20011 ~ 100. 

I can see performance slow down well before 100.000 unique string are 
interned.

And remember that the number of strings that FOP explicit intern must be 
added to the number of intern'ed string that the classloaders has 
created and whatever all the other components that are loaded has created.

>>Ad.2: The memory sharing can implemented by using intern'ed string but 
>>it is a very bad idea to do that. A normal java.util.Hashtable can be 
>>used just as well for the implementation of memory sharing:
> 
> 
> HashMap you mean.

Well sure, but a Hashtable is slightly faster.

I've attached another demo program that shows that intern'ing is slower 
than doing memory sharing with a Hashtable. This programs creates 13520 
unique strings and does 9 subsequent lookup of the same strings.

regards,
finn

Mime
View raw message