Re: RFR: 8333103: Re-examine the console provider loading [v2]

2024-06-03 Thread Naoto Sato
On Thu, 30 May 2024 19:48:25 GMT, Naoto Sato wrote: >> There is an initialization code in `Console` class that searches for the >> Console implementations. Refactoring the init code not to use lambda/stream >> would reduce the (initial) number of loaded classes by about 100 for >> java.base im

Re: RFR: 8333103: Re-examine the console provider loading [v2]

2024-05-30 Thread Naoto Sato
> There is an initialization code in `Console` class that searches for the > Console implementations. Refactoring the init code not to use lambda/stream > would reduce the (initial) number of loaded classes by about 100 for > java.base implementations. This would become relevant when the java.io

Re: RFR: 8333103: Re-examine the console provider loading

2024-05-30 Thread Naoto Sato
On Thu, 30 May 2024 18:38:59 GMT, Pavel Rappo wrote: >> In fact, this started simply for incorporating JLine implementation into >> Console, and using ServiceLoader was a mere means to load its impl as it >> resides outside the java.base module. So yes, module and its console >> implementation

Re: RFR: 8333103: Re-examine the console provider loading

2024-05-30 Thread Pavel Rappo
On Thu, 30 May 2024 18:10:14 GMT, Naoto Sato wrote: >> Claes has described the issue well. Like I said, `break` short-circuits the >> search. If a module can provide more than one console provider, the >> suggested stream-less replacement is **not** equivalent. >> >> If a module can provide mo

Re: RFR: 8333103: Re-examine the console provider loading

2024-05-30 Thread Naoto Sato
On Thu, 30 May 2024 08:23:25 GMT, Pavel Rappo wrote: >> It's only semantically the same if we assume a module can only provide a >> single `JdkConsoleProvider`, no? The `break;` disallows multiple providers >> (for disjoint sets of charsets) in a single module. > > Claes has described the issue

Re: RFR: 8333103: Re-examine the console provider loading

2024-05-30 Thread Jan Lahoda
On Wed, 29 May 2024 19:51:36 GMT, Naoto Sato wrote: > There is an initialization code in `Console` class that searches for the > Console implementations. Refactoring the init code not to use lambda/stream > would reduce the (initial) number of loaded classes by about 100 for > java.base implem

Re: RFR: 8333103: Re-examine the console provider loading

2024-05-30 Thread Claes Redestad
On Thu, 30 May 2024 10:02:25 GMT, Alan Bateman wrote: > Would it be possible to provide more context/background here? This is not > code that is used during startup. Is there benchmark data to share for first > use of java.io.IO ? I think this was brought to the fore by https://openjdk.org/jep

Re: RFR: 8333103: Re-examine the console provider loading

2024-05-30 Thread Alan Bateman
On Wed, 29 May 2024 19:51:36 GMT, Naoto Sato wrote: > There is an initialization code in `Console` class that searches for the > Console implementations. Refactoring the init code not to use lambda/stream > would reduce the (initial) number of loaded classes by about 100 for > java.base implem

Re: RFR: 8333103: Re-examine the console provider loading

2024-05-30 Thread Pavel Rappo
On Thu, 30 May 2024 07:44:24 GMT, Claes Redestad wrote: >> Right. Since `findAny` is after the module name matching, there is at most 1 >> match. In the case we didn't find any, the final `orElse(null)` eventually >> returns null. So the refactored code is semantically the same. > > It's only s

Re: RFR: 8333103: Re-examine the console provider loading

2024-05-30 Thread Claes Redestad
On Wed, 29 May 2024 22:25:09 GMT, Naoto Sato wrote: >> Yes, `break` guarantees that the search completes one way or another once >> the module name has been matched. This is not how it used to be done. > > Right. Since `findAny` is after the module name matching, there is at most 1 > match. In

Re: RFR: 8333103: Re-examine the console provider loading

2024-05-29 Thread Jaikiran Pai
On Wed, 29 May 2024 19:51:36 GMT, Naoto Sato wrote: > There is an initialization code in `Console` class that searches for the > Console implementations. Refactoring the init code not to use lambda/stream > would reduce the (initial) number of loaded classes by about 100 for > java.base implem

Re: RFR: 8333103: Re-examine the console provider loading

2024-05-29 Thread Naoto Sato
On Wed, 29 May 2024 21:39:37 GMT, Pavel Rappo wrote: >> src/java.base/share/classes/java/io/Console.java line 673: >> >>> 671: return new ProxyingConsole(jc); >>> 672: } >>> 673: break; >> >> Suggestion: >>

Re: RFR: 8333103: Re-examine the console provider loading

2024-05-29 Thread Pavel Rappo
On Wed, 29 May 2024 21:27:30 GMT, Chen Liang wrote: >> There is an initialization code in `Console` class that searches for the >> Console implementations. Refactoring the init code not to use lambda/stream >> would reduce the (initial) number of loaded classes by about 100 for >> java.base im

Re: RFR: 8333103: Re-examine the console provider loading

2024-05-29 Thread Chen Liang
On Wed, 29 May 2024 19:51:36 GMT, Naoto Sato wrote: > There is an initialization code in `Console` class that searches for the > Console implementations. Refactoring the init code not to use lambda/stream > would reduce the (initial) number of loaded classes by about 100 for > java.base implem

Re: RFR: 8333103: Re-examine the console provider loading

2024-05-29 Thread Claes Redestad
On Wed, 29 May 2024 19:51:36 GMT, Naoto Sato wrote: > There is an initialization code in `Console` class that searches for the > Console implementations. Refactoring the init code not to use lambda/stream > would reduce the (initial) number of loaded classes by about 100 for > java.base implem

RFR: 8333103: Re-examine the console provider loading

2024-05-29 Thread Naoto Sato
There is an initialization code in `Console` class that searches for the Console implementations. Refactoring the init code not to use lambda/stream would reduce the (initial) number of loaded classes by about 100 for java.base implementations. This would become relevant when the java.io.IO (JEP