On Fri, 21 Apr 2023 16:49:54 GMT, Vicente Romero <vrom...@openjdk.org> wrote:

>> Jan Lahoda has updated the pull request incrementally with two additional 
>> commits since the last revision:
>> 
>>  - Adding test.
>>  - Removing redundant continue, as noted on the review.
>
> 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

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13074#discussion_r1175260039

Reply via email to