ReRe: performance (shellsort experiments)

Per Bothner per@bothner.com
Tue Sep 7 18:13:00 GMT 1999


Kresten> ... I think the most significant single
Kresten> thing one could do right now would be to implement uniquing
Kresten> for Utf8Const's, both in the linker and in the runtime
Kresten> system.

For pre-compiled code, I think the Utf8Consts are less important.
They are used for the names of reflexive components, which should
not be used much in normal code.  They are also used for String
literals, though.  My model was that we would uniq Strings,
at least when doing static linking.  If you uniq the Strings in
the linker, then you don't need the corresponding Utf8Const objects
at all; the compiler just generates a direct reference to the (linker-
allocated) String object.

Things are a bit more difficult if you are using a dynamic linker.
Ideally, you want to have your dynamic linker be able to resolve
reference to undefined Strings by alocated intern'd Strings as
needed.   I don't know enough about dynamic linkes to know if
there is a practical way to do it.  In a pinch, you can always
use an extra level of indirection, and have the interning be
handled by .init code, but the performance win is less.
However, you can still combine all the strings (and Utf8Consts)
in the same "object" (shared library or main program).

For interpreted code, the Utf8Consts are a much bigger deal, since
the interpreter needs to do a lot of name resolution.  But since
my bias is to concentrate on the performance of pre-compiled code,
I would suggest first concentrating on optimizing interning of
String literals (which the spec *requires* be intern'd).  Once
we have that working, one solution to the Utf8Const problem
is doing away with them altogether:  Only use Strings.  This
has teh side benefit that we can use the same Strings in the
*internal* reflective data structures as was use in the
java.lang.reflect and JNI APIs.

The downside of replacing all Utf8Consts by intern'd Strings:
(a) more space needed for a String than for a Utf8Consts.
(b) more "loading" of the hash table used for interning.
-- 
	--Per Bothner
bothner@pacbell.net  per@bothner.com   http://www.bothner.com/~per/


More information about the Java mailing list