Re: RFR: 8273656: Improve java.lang.invoke.MethodType.parameterList() and its usage

2021-09-28 Thread Joseph D. Darcy
On 9/22/2021 4:53 PM, Claes Redestad wrote: On Mon, 13 Sep 2021 11:06:15 GMT, Сергей Цыпанов wrote: Currently the method is implemented like public List> parameterList() { return Collections.unmodifiableList(Arrays.asList(ptypes.clone())); } This seems to be excessive, as three objects

Re: RFR: 8273656: Improve java.lang.invoke.MethodType.parameterList() and its usage

2021-09-22 Thread Claes Redestad
On Mon, 13 Sep 2021 11:06:15 GMT, Сергей Цыпанов wrote: > Currently the method is implemented like > > public List> parameterList() { > return Collections.unmodifiableList(Arrays.asList(ptypes.clone())); > } > > This seems to be excessive, as three objects are allocated here. Instead we >

Re: RFR: 8273656: Improve java.lang.invoke.MethodType.parameterList() and its usage

2021-09-22 Thread Jorn Vernee
On Mon, 13 Sep 2021 11:06:15 GMT, Сергей Цыпанов wrote: > Currently the method is implemented like > > public List> parameterList() { > return Collections.unmodifiableList(Arrays.asList(ptypes.clone())); > } > > This seems to be excessive, as three objects are allocated here. Instead we >

Re: RFR: 8273656: Improve java.lang.invoke.MethodType.parameterList() and its usage

2021-09-22 Thread Claes Redestad
On Wed, 22 Sep 2021 00:21:01 GMT, Claes Redestad wrote: >> Currently the method is implemented like >> >> public List> parameterList() { >> return Collections.unmodifiableList(Arrays.asList(ptypes.clone())); >> } >> >> This seems to be excessive, as three objects are allocated here. Instead

Re: RFR: 8273656: Improve java.lang.invoke.MethodType.parameterList() and its usage

2021-09-22 Thread Jorn Vernee
On Mon, 13 Sep 2021 11:06:15 GMT, Сергей Цыпанов wrote: > Currently the method is implemented like > > public List> parameterList() { > return Collections.unmodifiableList(Arrays.asList(ptypes.clone())); > } > > This seems to be excessive, as three objects are allocated here. Instead we >

Re: RFR: 8273656: Improve java.lang.invoke.MethodType.parameterList() and its usage

2021-09-22 Thread Сергей Цыпанов
On Wed, 22 Sep 2021 00:21:01 GMT, Claes Redestad wrote: >> Currently the method is implemented like >> >> public List> parameterList() { >> return Collections.unmodifiableList(Arrays.asList(ptypes.clone())); >> } >> >> This seems to be excessive, as three objects are allocated here. Instead

Re: RFR: 8273656: Improve java.lang.invoke.MethodType.parameterList() and its usage

2021-09-21 Thread Claes Redestad
On Mon, 13 Sep 2021 11:06:15 GMT, Сергей Цыпанов wrote: > Currently the method is implemented like > > public List> parameterList() { > return Collections.unmodifiableList(Arrays.asList(ptypes.clone())); > } > > This seems to be excessive, as three objects are allocated here. Instead we >

Re: RFR: 8273656: Improve java.lang.invoke.MethodType.parameterList() and its usage

2021-09-21 Thread John Rose
On Sep 13, 2021, at 10:24 AM, Vladimir Ivanov mailto:vliva...@openjdk.java.net>> wrote: BTW it can be improved even further by caching the immutable List view of parameters. I would go further: If I were writing MethodType.java today I would probably use List.of as the backing store for the

Re: RFR: 8273656: Improve java.lang.invoke.MethodType.parameterList() and its usage

2021-09-13 Thread Mandy Chung
On Mon, 13 Sep 2021 11:06:15 GMT, Сергей Цыпанов wrote: > Currently the method is implemented like > > public List> parameterList() { > return Collections.unmodifiableList(Arrays.asList(ptypes.clone())); > } > > This seems to be excessive, as three objects are allocated here. Instead we >

Re: RFR: 8273656: Improve java.lang.invoke.MethodType.parameterList() and its usage

2021-09-13 Thread Vladimir Ivanov
On Mon, 13 Sep 2021 11:06:15 GMT, Сергей Цыпанов wrote: > Currently the method is implemented like > > public List> parameterList() { > return Collections.unmodifiableList(Arrays.asList(ptypes.clone())); > } > > This seems to be excessive, as three objects are allocated here. Instead we >

Re: RFR: 8273656: Improve java.lang.invoke.MethodType.parameterList() and its usage

2021-09-13 Thread Jorn Vernee
On Mon, 13 Sep 2021 11:06:15 GMT, Сергей Цыпанов wrote: > Currently the method is implemented like > > public List> parameterList() { > return Collections.unmodifiableList(Arrays.asList(ptypes.clone())); > } > > This seems to be excessive, as three objects are allocated here. Instead we >

Re: RFR: 8273656: Improve java.lang.invoke.MethodType.parameterList() and its usage

2021-09-13 Thread Jorn Vernee
On Mon, 13 Sep 2021 11:06:15 GMT, Сергей Цыпанов wrote: > Currently the method is implemented like > > public List> parameterList() { > return Collections.unmodifiableList(Arrays.asList(ptypes.clone())); > } > > This seems to be excessive, as three objects are allocated here. Instead we >

RFR: 8273656: Improve java.lang.invoke.MethodType.parameterList() and its usage

2021-09-13 Thread Сергей Цыпанов
Currently the method is implemented like public List> parameterList() { return Collections.unmodifiableList(Arrays.asList(ptypes.clone())); } This seems to be excessive, as three objects are allocated here. Instead we can use `List.of(ptypes)` which doesn't allocate anything for empty array