On Tue, 30 Apr 2024 12:13:59 GMT, Adam Sotona <asot...@openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/classfile/impl/BoundAttribute.java >> line 996: >> >>> 994: public static AttributeMapper<?> standardAttribute(Utf8Entry name) >>> { >>> 995: // critical bootstrap path, so no lambdas nor method handles >>> here >>> 996: return switch (name.hashCode()) { >> >> I think we can safely switch over strings, as they are compiled to hashCode >> switch like what you explicitly have right now. Isn't that the case? > > Freshly parsed Utf8Entries conversion to String is expensive and unnecessary. > We should be very careful when to ask for the conversion as it significantly > affects some benchmarks. You are right, I forgot these are Utf8Entry instead of Strings. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19006#discussion_r1584719802