Hi Peter,

On 2018-04-25 08:36, Peter Levart wrote:
Hi Claes,

Nice play with CHM and safe publication.

thanks, I was curious how you'd react to this. :-)


If findSpecies() is on a hot concurrent path, [...]

It'd be surprising if it was: findSpecies is typically called once for a specific SpeciesData, and sometimes every now and then during setup of certain method handles (in particular the static speciesData_L* methods in jli.BoundMethodHandle are begging to be turned
into lazy constants).

Besides, CHM.computeIfAbsent has a non-synchronizing fast-path for when the key exists,
lines 1731-1734:

            else if (fh == h    // check first node without acquiring lock
                     && ((fk = f.key) == key || (fk != null && key.equals(fk)))
                     && (fv = f.val) != null)
                return fv;

.. so I'm not sure we'd gain much from wrapping the preface with a get even if it was
hot and contended.

/Claes

Reply via email to