On Tue, 8 Mar 2022 14:02:39 GMT, Jim Laskey <jlas...@openjdk.org> wrote:
> We propose to provide a runtime anonymous carrier class object generator; > java.lang.runtime.Carrier. This generator class is designed to share > anonymous classes when shapes are similar. For example, if several clients > require objects containing two integer fields, then Carrier will ensure that > each client generates carrier objects using the same underlying anonymous > class. > > See JBS for details. Note that the Object[] + int/long[] trick is pretty close to how we implemented objects in Nashorn and we got decent performance there. I'll run some jmh tests and compare against the anon class. As Brian states, it's not the implementation, it's the API. ------------- PR: https://git.openjdk.java.net/jdk/pull/7744