On Mon, 24 Apr 2023 13:08:44 GMT, Jan Lahoda <jlah...@openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java line 315: >> >>> 313: Object[] labels = resolvedLabels.resolvedLabels; >>> 314: >>> 315: // Dumbest possible strategy >> >> I guess that given that we can't make any assumption about order here, this >> is the only possible strategy so I guess it makes sense to remove the comment > > I certainly hope we can do better. At very least, the current implementation > is checking the type of the labels on each pass through the loop. The types > of the labels don't change, so checking them again and again is not > necessary. In some cases, it might be possible to improve even further, like > e.g. in a case where all the labels are enum constants, then we could use a > e.g. mapping table. > > There's a PR proposed that shows some of that: > https://github.com/openjdk/jdk/pull/9779 I see, interesting ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13074#discussion_r1175471366