Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow [v5]

2023-11-13 Thread Vicente Romero
On Tue, 7 Nov 2023 14:18:41 GMT, Jan Lahoda wrote: >> Consider code like: >> >> void test(Object o) { >> switch (o) { >> case X1 -> {} >> case X2 -> {} >> ...(about 100 cases) >> ``` >> >> javac will compile the switch into a switch whose selector is an indy >> invocation

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow [v5]

2023-11-07 Thread Jan Lahoda
> Consider code like: > > void test(Object o) { > switch (o) { > case X1 -> {} > case X2 -> {} > ...(about 100 cases) > ``` > > javac will compile the switch into a switch whose selector is an indy > invocation to `SwitchBootstraps.typeSwitch`, with static arguments being

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow [v4]

2023-11-03 Thread Jan Lahoda
> Consider code like: > > void test(Object o) { > switch (o) { > case X1 -> {} > case X2 -> {} > ...(about 100 cases) > ``` > > javac will compile the switch into a switch whose selector is an indy > invocation to `SwitchBootstraps.typeSwitch`, with static arguments being

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow [v3]

2023-11-03 Thread Rémi Forax
On Fri, 3 Nov 2023 16:43:30 GMT, Jan Lahoda wrote: >> Consider code like: >> >> void test(Object o) { >> switch (o) { >> case X1 -> {} >> case X2 -> {} >> ...(about 100 cases) >> ``` >> >> javac will compile the switch into a switch whose selector is an indy >> invocation

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow [v2]

2023-11-03 Thread Jan Lahoda
On Fri, 3 Nov 2023 15:50:43 GMT, Rémi Forax wrote: >> Jan Lahoda has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - Some more get->orElseThrow >> - Reflecting review feedback. > >

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow [v3]

2023-11-03 Thread Jan Lahoda
> Consider code like: > > void test(Object o) { > switch (o) { > case X1 -> {} > case X2 -> {} > ...(about 100 cases) > ``` > > javac will compile the switch into a switch whose selector is an indy > invocation to `SwitchBootstraps.typeSwitch`, with static arguments being

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow [v2]

2023-11-03 Thread Jan Lahoda
On Fri, 3 Nov 2023 15:24:48 GMT, Jan Lahoda wrote: >> src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java line 346: >> >>> 344: Class clazz = >>> label.constantType().resolveConstantDesc(lookup); >>> 345: >>> 346: if (value.getClass() !=

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow [v2]

2023-11-03 Thread Rémi Forax
On Fri, 3 Nov 2023 15:32:34 GMT, Jan Lahoda wrote: >> Consider code like: >> >> void test(Object o) { >> switch (o) { >> case X1 -> {} >> case X2 -> {} >> ...(about 100 cases) >> ``` >> >> javac will compile the switch into a switch whose selector is an indy >> invocation

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow

2023-11-03 Thread Rémi Forax
On Fri, 3 Nov 2023 15:29:05 GMT, Jan Lahoda wrote: > Thanks for all the comments so far - I think I've either reflected them, or > wrote a comment to each of them. Please let me know if there's something > else, or if I've forgotten something. You idea to use an extra array is clever. Using

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow [v2]

2023-11-03 Thread Rémi Forax
On Fri, 3 Nov 2023 15:32:34 GMT, Jan Lahoda wrote: >> Consider code like: >> >> void test(Object o) { >> switch (o) { >> case X1 -> {} >> case X2 -> {} >> ...(about 100 cases) >> ``` >> >> javac will compile the switch into a switch whose selector is an indy >> invocation

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow [v2]

2023-11-03 Thread Rémi Forax
On Fri, 3 Nov 2023 15:32:34 GMT, Jan Lahoda wrote: >> Consider code like: >> >> void test(Object o) { >> switch (o) { >> case X1 -> {} >> case X2 -> {} >> ...(about 100 cases) >> ``` >> >> javac will compile the switch into a switch whose selector is an indy >> invocation

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow [v2]

2023-11-03 Thread Jan Lahoda
On Fri, 3 Nov 2023 14:19:17 GMT, Rémi Forax wrote: >> Jan Lahoda has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - Some more get->orElseThrow >> - Reflecting review feedback. > >

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow [v2]

2023-11-03 Thread Jan Lahoda
> Consider code like: > > void test(Object o) { > switch (o) { > case X1 -> {} > case X2 -> {} > ...(about 100 cases) > ``` > > javac will compile the switch into a switch whose selector is an indy > invocation to `SwitchBootstraps.typeSwitch`, with static arguments being

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow [v2]

2023-11-03 Thread Jan Lahoda
On Fri, 3 Nov 2023 09:48:15 GMT, Chen Liang wrote: >> Jan Lahoda has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - Some more get->orElseThrow >> - Reflecting review feedback. > >

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow

2023-11-03 Thread Jan Lahoda
On Fri, 3 Nov 2023 08:41:12 GMT, Jan Lahoda wrote: > Consider code like: > > void test(Object o) { > switch (o) { > case X1 -> {} > case X2 -> {} > ...(about 100 cases) > ``` > > javac will compile the switch into a switch whose selector is an indy > invocation to

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow

2023-11-03 Thread Rémi Forax
On Fri, 3 Nov 2023 08:41:12 GMT, Jan Lahoda wrote: > Consider code like: > > void test(Object o) { > switch (o) { > case X1 -> {} > case X2 -> {} > ...(about 100 cases) > ``` > > javac will compile the switch into a switch whose selector is an indy > invocation to

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow

2023-11-03 Thread Rémi Forax
On Fri, 3 Nov 2023 08:41:12 GMT, Jan Lahoda wrote: > Consider code like: > > void test(Object o) { > switch (o) { > case X1 -> {} > case X2 -> {} > ...(about 100 cases) > ``` > > javac will compile the switch into a switch whose selector is an indy > invocation to

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow

2023-11-03 Thread Rémi Forax
On Fri, 3 Nov 2023 08:41:12 GMT, Jan Lahoda wrote: > Consider code like: > > void test(Object o) { > switch (o) { > case X1 -> {} > case X2 -> {} > ...(about 100 cases) > ``` > > javac will compile the switch into a switch whose selector is an indy > invocation to

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow

2023-11-03 Thread Chen Liang
On Fri, 3 Nov 2023 08:41:12 GMT, Jan Lahoda wrote: > Consider code like: > > void test(Object o) { > switch (o) { > case X1 -> {} > case X2 -> {} > ...(about 100 cases) > ``` > > javac will compile the switch into a switch whose selector is an indy > invocation to

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow

2023-11-03 Thread Jan Lahoda
On Fri, 3 Nov 2023 08:51:48 GMT, Adam Sotona wrote: >> Consider code like: >> >> void test(Object o) { >> switch (o) { >> case X1 -> {} >> case X2 -> {} >> ...(about 100 cases) >> ``` >> >> javac will compile the switch into a switch whose selector is an indy >>

Re: RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow

2023-11-03 Thread Adam Sotona
On Fri, 3 Nov 2023 08:41:12 GMT, Jan Lahoda wrote: > Consider code like: > > void test(Object o) { > switch (o) { > case X1 -> {} > case X2 -> {} > ...(about 100 cases) > ``` > > javac will compile the switch into a switch whose selector is an indy > invocation to

RFR: 8319220: Pattern matching switch with a lot of cases is unduly slow

2023-11-03 Thread Jan Lahoda
Consider code like: void test(Object o) { switch (o) { case X1 -> {} case X2 -> {} ...(about 100 cases) ``` javac will compile the switch into a switch whose selector is an indy invocation to `SwitchBootstraps.typeSwitch`, with static arguments being the types in the