Loading... (original) (raw)

Archiving the IntegerCache into the CDS archive turns out to be profitable.

Experiments shows ~1M fewer instructions in the default case (<0.5ms), with an implementation that deals gracefully with cases where a larger or smaller cache than archived has been requested.

In case a larger cache is archived and then requested, the gain is greater since the loading/mapping of the cache happens in constant rather than linear time, observing a ~150ms speedup on something like this:

java -Xshare:dump -Djava.lang.Integer.IntegerCache.high=65535
java -Xshare:on -Djava.lang.Integer.IntegerCache.high=65535 HelloWorld