Constant pool optimization

Maxim Kizub max at immsp.kiev.ua
Thu Jan 28 08:48:29 PST 1999


Hello.

Looking at memory profile made by per-method basis,
I was impressed how mach of memory takes constant
pool.

I my case that was 530 kb!

I think, there is one possible quick improvement.
since all CONSTANT_Utf8 constants are not used
directly, we may simply remove them, after
class file parsing.

If I'm not wrong, javac & kiev sorts constant
pool to put all utf8 constants at the bottom
of the pool. It's possible to simply delete the
tail of the pool in most cases. This may reduse
the size, allocated by CP about 2 times, especially,
if classes were genereted with debug info (-g switch).

I think, a couple lines of code may save about 200 kb
for big programs.

Regards
  Maxim Kizub



More information about the kaffe mailing list