indy-based string-switch proposal

John Rose john.r.rose at oracle.com
Mon Nov 4 23:09:12 UTC 2019


On Nov 4, 2019, at 2:27 PM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> 
> repeating structure using candy

Such as an apartment building canvassed by trick-or-treaters?
(Boo, spell-check!)

Condy can be good for factoring out repeats.
But watch the per-condy overhead.

Sometimes there’s a good answer from cooking up a
simple stringy DSL as with the string concatenation work.

When I evaluate alternative encoding schemes I usually
ask what is the expected number of constant pool indexes
burned, for an average use case.  Sometimes class file
size (in bytes) comes into it also, but CP slots are a uniquely
limited resource, since the whole class file has to make
do with 2^16-1 of them.

The important goal, IMO, is to make each constant
in an indy/condy construct carry its weight, or else
somehow maintain an expectation that the constant
is probably already in use somewhere else in the
class file.

— John

P.S. There are incremental ways to lift the 2^16-1 restriction,
if we ever need to go there.  See notes on CONSTANT_Group
in https://bugs.openjdk.java.net/browse/JDK-8161256




More information about the amber-dev mailing list