harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Salikh Zakirov <Salikh.Zaki...@Intel.com>
Subject Re: [drlvm] string interning in java
Date Mon, 31 Jul 2006 15:12:32 GMT
Salikh Zakirov wrote:
> I have been looking to the string interning code in DRLVM recently.
> ...
> Now I am going to attempt optimization of java code by using
> a customized weak hashmap implementation. 
> By using it, I will be able to create just one weak reference
> to the interned string instead of current two, and to perform
> just one hash lookup instead of two on interning new string.

So I did it.
I have taken java.lang.WeakHashMap, trimmed all the irrelevant
code, and implemented intern() method, which returns the key
if the string is already present in the table, and stores
the string if it was not.

The optimized implementation brings little advantage,
here is the data (again, running Hello application on my laptop)

baseline:	avg    0.265 +/- 0.001 =    26.511 / 100, min    0.254, max    0.319
WeakHashMap:	avg    0.270 +/- 0.001 =    26.952 / 100, min    0.258, max    0.310
customized:	avg    0.268 +/- 0.001 =    26.815 / 100, min    0.256, max    0.309

Thus, the optimized java implementation of interned strings
brings overhead down about 1%.

The patch to implement customized InternMap, based on WeakHashMap code
is attached.

Is anyone reviewing patches? I think it is genarally more convenient
to review patches sent to the list, because it is easy to hit "reply"
and put the comments inline to the particular code.
(This practice is widely used in other mailing lists I am looking through, e.g. Git)

I will file a JIRA with patches anyway to make sure the patch is not lost.
(in hope that it will be eventually applied)

--
Salikh Zakirov, Intel Middleware Products Division 


Mime
View raw message