After some more Google
-ing, I discovered that this is a known problem.
In fact there is a bug
is slow if the String
contains non-latin characters.
In my case the String
s contain Hebrew characters.
In my application, I retrieve about 500 String
s from a database and invoke FontMetrics.stringWidth()
on each one - does that serve as a proper benchmark
In any case, I believe my original question is still the issue and that is:
Why is FontMetrics.stringWidth()
faster in jdk1.5.0_07?
In order to obtain an answer to that question, I guess I should compare the source code for the method in the different java versions.
So I will now Google
for the source code - but if someone can point me in the right direction, I would appreciate it.