Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v3]

2024-07-15 Thread Rémi Forax
On Mon, 15 Jul 2024 11:33:30 GMT, Jorn Vernee wrote: >> This PR limits the number of cases in which we deoptimize frames when >> closing a shared Arena. The initial intent of this was to improve the >> performance of shared arena closure in cases where a lot of threads are >> accessing and

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v2]

2024-07-15 Thread Rémi Forax
On Mon, 15 Jul 2024 10:50:34 GMT, Jorn Vernee wrote: > This is what I was thinking of as well. close() on a shared arena can be > called by any thread, so it would be possible to have an executor service > with 1-n threads that is dedicated to closing memory. This delays both the closing of

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v2]

2024-07-13 Thread Rémi Forax
On Fri, 12 Jul 2024 20:59:26 GMT, Jorn Vernee wrote: >> This PR limits the number of cases in which we deoptimize frames when >> closing a shared Arena. The initial intent of this was to improve the >> performance of shared arena closure in cases where a lot of threads are >> accessing and

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v2]

2024-07-13 Thread Rémi Forax
On Fri, 12 Jul 2024 20:59:26 GMT, Jorn Vernee wrote: >> This PR limits the number of cases in which we deoptimize frames when >> closing a shared Arena. The initial intent of this was to improve the >> performance of shared arena closure in cases where a lot of threads are >> accessing and

Re: [External] : Gatherer and primitive specialization

2024-06-13 Thread forax
> From: "Viktor Klang" > To: "Remi Forax" , "core-libs-dev" > > Sent: Thursday, June 13, 2024 12:52:03 PM > Subject: Re: [External] : Gatherer and primitive specialization > Hi Rémi, > Given that Collector has not been specialized since

Gatherer and primitive specialization

2024-06-13 Thread Remi Forax
Hello, the Gatherer API do not provide primitive specialization while intermediate methods like map(), flatMap() or mapMulti() do. Unlike collectors where it is okay to not be specialized because most collectors mutate a collection that is not specialized too, gatherers can process/transform

Re: RFR: 8333265: De-duplicate method references in java.util.stream.FindOps

2024-05-30 Thread Rémi Forax
On Thu, 30 May 2024 12:50:36 GMT, Claes Redestad wrote: > Extracting duplicate method references to static field reduce proxy class > spinning and loading. In this case 2 less classes loaded when using > `findAny()` on each type of stream. For constant method reference, the solution is to use

Re: RFR: 8242888: Convert dynamic proxy to hidden classes

2024-05-23 Thread forax
> From: "-" > To: "Remi Forax" > Cc: "Chen Liang" , "core-libs-dev" > , "hotspot-dev" , > "kulla-dev" > Sent: Thursday, May 23, 2024 2:56:58 PM > Subject: Re: RFR: 8242888: Convert dynamic proxy to hidden classes

Re: RFR: 8242888: Convert dynamic proxy to hidden classes

2024-05-23 Thread Remi Forax
- Original Message - > From: "Chen Liang" > To: "core-libs-dev" , "hotspot-dev" > , kulla-...@openjdk.org > Sent: Thursday, May 23, 2024 1:28:01 PM > Subject: Re: RFR: 8242888: Convert dynamic proxy to hidden classes > On Thu, 23 May 2024 03:28:30 GMT, Chen Liang wrote: > >> Please

Re: RFR: 8330465: Stable Values and Collections (Internal) [v4]

2024-05-15 Thread Rémi Forax
On Wed, 15 May 2024 11:27:04 GMT, ExE Boss wrote: >>> Maybe export this interface to `jdk.unsupported`? >> >> I don't we should do that. In general, we need jdk.unsupported to go away in >> the long term. Also integrity of the platform depends on java.base being >> very stingy and not

Re: RFR: 8305457: Implement java.io.IO [v3]

2024-05-07 Thread Rémi Forax
On Tue, 7 May 2024 16:09:08 GMT, Pavel Rappo wrote: >> I do not think the step to "standardise" a preview feature exists ? When a >> preview feature becomes a released feature, the code is very lightly edited, >> at least it this is my experience. >> >> You can change both readln and

Re: RFR: 8305457: Implement java.io.IO

2024-05-07 Thread Rémi Forax
On Tue, 7 May 2024 11:00:52 GMT, Pavel Rappo wrote: >> src/java.base/share/classes/jdk/internal/io/JdkConsoleImpl.java line 74: >> >>> 72: >>> 73: @Override >>> 74: public String readln(String prompt) { >> >> this code can be simplified using an early return (and the body of the >>

Re: RFR: 8305457: Implement java.io.IO

2024-05-06 Thread Rémi Forax
On Mon, 6 May 2024 21:45:12 GMT, Pavel Rappo wrote: > Please review this PR which introduces the `java.io.IO` top-level class and > three methods to `java.io.Console` for [Implicitly Declared Classes and > Instance Main Methods (Third Preview)]. > > This PR has been obtained as `git merge

Re: Addition of Predicate-based findIndex and findLastIndex methods to java.util.List

2024-04-19 Thread forax
> From: "David Alayachew" > To: "Remi Forax" > Cc: "ІП-24 Олександр Ротань" , "core-libs-dev" > > Sent: Friday, April 19, 2024 11:02:12 PM > Subject: Re: Addition of Predicate-based findIndex and findLastIndex methods > to >

Re: Addition of Predicate-based findIndex and findLastIndex methods to java.util.List

2024-04-19 Thread Remi Forax
Hello, for me, it seems what you want is Collector on Stream which is able to short-circuit, so you can write list.stream().collect(Collectors.findFirst(s -> s.contains("o"))) and in reverse list.reversed().stream().collect(Collectors.findFirst(s -> s.contains("o"))) Using a Stream here is

Re: RFR: 8196106: Support nested infinite or recursive flat mapped streams [v7]

2024-04-13 Thread Rémi Forax
On Fri, 12 Apr 2024 14:53:01 GMT, Viktor Klang wrote: >> This PR implements Gatherer-inspired encoding of `flatMap` that shows that >> it is both competitive performance-wise as well as improve correctness. >> >> Below is the performance of `Stream::flatMap` (for reference types): >> >>

Re: RFR: 8196106: Support nested infinite or recursive flat mapped streams [v7]

2024-04-13 Thread Rémi Forax
On Fri, 12 Apr 2024 14:53:01 GMT, Viktor Klang wrote: >> This PR implements Gatherer-inspired encoding of `flatMap` that shows that >> it is both competitive performance-wise as well as improve correctness. >> >> Below is the performance of `Stream::flatMap` (for reference types): >> >>

Re: RFR: 8196106: Support nested infinite or recursive flat mapped streams [v7]

2024-04-13 Thread Rémi Forax
On Fri, 12 Apr 2024 14:53:01 GMT, Viktor Klang wrote: >> This PR implements Gatherer-inspired encoding of `flatMap` that shows that >> it is both competitive performance-wise as well as improve correctness. >> >> Below is the performance of `Stream::flatMap` (for reference types): >> >>

Re: RFR: 8327247: C2 uses up to 2GB of RAM to compile complex string concat in extreme cases

2024-04-12 Thread Rémi Forax
On Tue, 9 Apr 2024 12:01:49 GMT, Claes Redestad wrote: > This patch suggests a workaround to an issue with huge SCF MH expression > trees taking excessive JIT compilation resources by reviving (part of) the > simple bytecode-generating strategy that was originally available as an >

Re: Gatherer: spliterator characteristics are not propagated

2024-01-25 Thread forax
> From: "Viktor Klang" > To: "Remi Forax" > Cc: "core-libs-dev" , "Paul Sandoz" > > Sent: Wednesday, January 24, 2024 2:45:15 PM > Subject: Re: Gatherer: spliterator characteristics are not propagated > As a (related) s

Re: Gatherer: spliterator characteristics are not propagated

2024-01-25 Thread forax
> From: "Viktor Klang" > To: "Remi Forax" > Cc: "core-libs-dev" , "Paul Sandoz" > > Sent: Wednesday, January 24, 2024 2:34:11 PM > Subject: Re: Gatherer: spliterator characteristics are not propagated > Presuming that you mea

Re: Gatherer: spliterator characteristics are not propagated

2024-01-23 Thread forax
> From: "Viktor Klang" > To: "Remi Forax" > Cc: "core-libs-dev" , "Paul Sandoz" > > Sent: Monday, January 22, 2024 10:06:27 PM > Subject: Re: Gatherer: spliterator characteristics are not propagated >> The flags ar

Re: Gatherer: spliterator characteristics are not propagated

2024-01-22 Thread forax
> From: "Viktor Klang" > To: "Remi Forax" > Cc: "core-libs-dev" , "Paul Sandoz" > > Sent: Monday, January 22, 2024 4:22:11 PM > Subject: Re: Gatherer: spliterator characteristics are not propagated > Hi Rémi, Hello, >

Re: Gatherer: spliterator characteristics are not propagated

2024-01-20 Thread forax
> From: "Viktor Klang" > To: "Remi Forax" > Cc: "core-libs-dev" , "Paul Sandoz" > > Sent: Thursday, January 18, 2024 5:14:38 PM > Subject: Re: Gatherer: spliterator characteristics are not propagated >> And for A.andThen(B)

Re: Gatherer API : wildcards complaint

2024-01-18 Thread forax
> From: "Viktor Klang" > To: "Remi Forax" > Cc: "core-libs-dev" > Sent: Wednesday, January 17, 2024 9:00:32 PM > Subject: Re: Gatherer API : wildcards complaint > Ah, now I see what you mean! Thank you \uD83D\uDC4D > The reason for t

Re: Gatherer: spliterator characteristics are not propagated

2024-01-18 Thread forax
> From: "Viktor Klang" > To: "Remi Forax" > Cc: "core-libs-dev" , "Paul Sandoz" > > Sent: Thursday, January 18, 2024 3:36:07 PM > Subject: Re: Gatherer: spliterator characteristics are not propagated > I suspect that it is a ra

Re: Gatherer: spliterator characteristics are not propagated

2024-01-18 Thread forax
> From: "Viktor Klang" > To: "Remi Forax" , "core-libs-dev" > > Sent: Wednesday, January 17, 2024 8:48:07 PM > Subject: Re: Gatherer: spliterator characteristics are not propagated > Hi Rémi, > You can find some of my benches here: [ > htt

Re: Seing a Collector as a Gatherer

2024-01-17 Thread forax
> From: "Viktor Klang" > To: "Remi Forax" > Sent: Wednesday, January 17, 2024 6:01:38 PM > Subject: Re: Seing a Collector as a Gatherer > Hi Rémi, > Yes, this was something I was hoping to get into the preview, but I wasn't > sure > where that

Re: Gatherer API : wildcards complaint

2024-01-17 Thread forax
> From: "Viktor Klang" > To: "Remi Forax" , "core-libs-dev" > > Sent: Wednesday, January 17, 2024 5:49:01 PM > Subject: Re: Gatherer API : wildcards complaint > Hi Rémi, > Thank you for the feedback—examples would be much appreciated

Seing a Collector as a Gatherer

2024-01-17 Thread Remi Forax
Hello, I may have overlook that, but it seems there is no method to see a Collector as a Gatherer. A Gatherer is more general than a Collector and a Gatherer with a greedy integrator that does not call Downstream.push in the intergator and only once is the finisher is basicaly a Collector. In

Gatherer API : wildcards complaint

2024-01-17 Thread Remi Forax
Hello, this is a minor complaint but I do not see a raison to not getting this right. Currently the Gatherer API does not use the wildcard correctly, which is not fully an issue because there is "enough" wildcards that if you rely on the inference, it will work. The problem is that when you

Gatherer: spliterator characteristics are not propagated

2024-01-17 Thread Remi Forax
that this intermediate operation keep the size, which is important if the terminal operation is toList() because if the size is known, toList() will presize the List and avoid the creation of an intermediary ArrayList. See https://github.com/forax/we_are_all_to_gather/blob/master/src/main/java/com/gihtub/forax

Improving the Gatherer public API

2024-01-17 Thread Remi Forax
Hello, i've played quite a lot with the Gatherer API and overall, i quite like how things work conceptually. But i think the public API can be improved. First, the documentation is not fully clear that a Gatherer has 3 characteristics, 1/ Is it sequential or parallelizable (can be parallel is

Re: Gatherers -- conditionalWindowFixed?

2024-01-10 Thread Remi Forax
> From: "Viktor Klang" > To: "David Alayachew" , "core-libs-dev" > > Sent: Wednesday, January 10, 2024 2:33:45 PM > Subject: Re: Gatherers -- conditionalWindowFixed? > Hi David! > Apologies for the late reply, there's been lots of catching up to do after the > holidays. > >I'm really excited

Re: Gatherers -- conditionalWindowFixed?

2024-01-10 Thread Remi Forax
> From: "Remi Forax" > To: "David Alayachew" > Cc: "core-libs-dev" > Sent: Wednesday, January 10, 2024 8:19:15 AM > Subject: Re: Gatherers -- conditionalWindowFixed? > Hello David, > testing the gatherer api, I also wanted a "window&

Re: Gatherers -- conditionalWindowFixed?

2024-01-09 Thread Remi Forax
Hello David, testing the gatherer api, I also wanted a "window" operation as the one you are describing. My use cases is a text file with some sections containing items organized like this :section1 item1 item2 item3 :section2 item1 item2 ... For me the signature of such method,

Re: Blessed modifier order does not include sealed/non-sealed

2024-01-02 Thread Remi Forax
- Original Message - > From: "Pavel Rappo" > To: "Roger Riggs" > Cc: "core-libs-dev" > Sent: Tuesday, January 2, 2024 5:31:06 PM > Subject: Re: Blessed modifier order does not include sealed/non-sealed > Hi Roger, > > Happy New Year to you too! > > Although it's a _somewhat_ separate

Re: Blessed modifier order does not include sealed/non-sealed

2024-01-02 Thread Remi Forax
- Original Message - > From: "Pavel Rappo" > To: "core-libs-dev" > Sent: Tuesday, January 2, 2024 12:56:08 PM > Subject: Blessed modifier order does not include sealed/non-sealed > I couldn't find any prior discussions on this matter. > > I noticed that bin/blessed-modifier-order.sh

Re: RFR: 8322292: Rearrange comparison of fields in Record.equals()

2023-12-19 Thread Rémi Forax
On Tue, 19 Dec 2023 11:01:12 GMT, Hannes Greule wrote: > Isn't Arrays.equals() used under the hood? No, for arrays == is used - PR Comment: https://git.openjdk.org/jdk/pull/17143#issuecomment-1863374656

Re: RFR: 8319123: Implementation of JEP-461: Stream Gatherers (Preview) [v7]

2023-11-14 Thread Remi Forax
- Original Message - > From: "Viktor Klang" > To: "core-libs-dev" > Sent: Tuesday, November 14, 2023 11:32:48 AM > Subject: Re: RFR: 8319123: Implementation of JEP-461: Stream Gatherers > (Preview) [v7] > On Tue, 14 Nov 2023 09:48:13 GMT, Rémi F

Re: RFR: 8319123: Implementation of JEP-461: Stream Gatherers (Preview) [v7]

2023-11-14 Thread Rémi Forax
On Tue, 14 Nov 2023 07:51:42 GMT, Viktor Klang wrote: >> This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) > > Viktor Klang has updated the pull request incrementally with one additional > commit since the last revision: > > Addressing last review feedback Hello, the

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Mon, 30 Oct 2023 15:38:35 GMT, Viktor Klang wrote: > This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) src/java.base/share/classes/java/util/stream/Gatherers.java line 64: > 62: *needlessly > 63: * 3. allows for more efficient composition and evaluation >

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Mon, 30 Oct 2023 15:38:35 GMT, Viktor Klang wrote: > This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) src/java.base/share/classes/java/util/stream/GathererOp.java line 232: > 230: */ > 231: @SuppressWarnings("unchecked") > 232: private GathererOp(Gatherer

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Mon, 30 Oct 2023 15:38:35 GMT, Viktor Klang wrote: > This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) src/java.base/share/classes/java/util/stream/GathererOp.java line 448: > 446: private final long targetSize; > 447: private final Hybrid

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Mon, 30 Oct 2023 15:38:35 GMT, Viktor Klang wrote: > This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) src/java.base/share/classes/java/util/stream/GathererOp.java line 180: > 178: finisher.accept(state, this); > 179: sink.end(); > 180:

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Mon, 30 Oct 2023 15:38:35 GMT, Viktor Klang wrote: > This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) src/java.base/share/classes/java/util/stream/GathererOp.java line 95: > 93: public void accept(X x) { > 94: final var b = rightMost; > 95:

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Mon, 30 Oct 2023 15:38:35 GMT, Viktor Klang wrote: > This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) src/java.base/share/classes/java/util/stream/GathererOp.java line 50: > 48: */ > 49: final class GathererOp extends ReferencePipeline { > 50:

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Wed, 8 Nov 2023 17:22:05 GMT, Rémi Forax wrote: >> This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) > > src/java.base/share/classes/java/util/stream/Gatherer.java line 490: > >> 488: * more elements sent to it, {@code false

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Mon, 30 Oct 2023 15:38:35 GMT, Viktor Klang wrote: > This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) src/java.base/share/classes/java/util/stream/Gatherer.java line 444: > 442: */ > 443: static Gatherer of( > 444: Supplier initializer, wildcards

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Wed, 8 Nov 2023 15:17:57 GMT, Viktor Klang wrote: >> It's still possible to have a situation where PECS signature could be >> useful, and I don't see any downsides. A user may want to reuse the same >> static integrator instead of creating several identical lambdas just because >> the

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Sun, 5 Nov 2023 16:18:52 GMT, Tagir F. Valeev wrote: >> This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) > > src/java.base/share/classes/java/util/stream/Gatherer.java line 330: > >> 328: static Gatherer ofSequential( >> 329: Integrator integrator, >>

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Wed, 8 Nov 2023 17:10:05 GMT, Tagir F. Valeev wrote: >> Has this proven to be a problem for things like >> [Collectors.mapping(…)](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/stream/Collectors.html#mapping(java.util.function.Function,java.util.stream.Collector)) >>

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Tue, 31 Oct 2023 13:19:30 GMT, Viktor Klang wrote: >> This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) > > src/java.base/share/classes/java/util/stream/AbstractPipeline.java line 242: > >> 240: } >> 241: >> 242: // Terminal evaluation methods > > This is needed

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Fri, 3 Nov 2023 16:51:34 GMT, Viktor Klang wrote: >> Since stream facilities are package-private, we can just use no access >> modifier and remove all new `protected` access modifier (on methods, fields, >> constructors) in this PR. > > @liach We could do that, yet I'm not sure that is

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

2023-11-08 Thread Rémi Forax
On Mon, 30 Oct 2023 15:38:35 GMT, Viktor Klang wrote: > This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) src/java.base/share/classes/java/util/stream/AbstractPipeline.java line 223: > 221: * consumed > 222: */ > 223: protected AbstractPipeline(AbstractPipeline

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 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

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: JDK-8315458 Implementation of Implicitly Declared Classes and Instance Main Method (Second Preview) [v2]

2023-11-02 Thread Rémi Forax
On Thu, 2 Nov 2023 12:24:31 GMT, Jim Laskey wrote: >> Uhmm. In the spec I see implicit classes named here: >> >> >> For reference, the following constructs are declared implicitly in source >> code, but are not marked as mandated because only formal parameters and >> modules can be so

Re: [External] : Re: Update on JEP-461: Stream Gatherers (Preview)

2023-10-30 Thread Remi Forax
> From: "Viktor Klang" > To: "Tyler Kindy" > Cc: "core-libs-dev" > Sent: Monday, October 30, 2023 10:59:48 PM > Subject: Re: [External] : Re: Update on JEP-461: Stream Gatherers (Preview) > That's also a good point, and I've heard from multiple sources that sometimes > you want to make sure

Re: RFR: 8315850: Improve AbstractMap anonymous Iterator classes [v3]

2023-09-08 Thread Rémi Forax
On Fri, 8 Sep 2023 18:55:29 GMT, altrisi wrote: >> Per Minborg has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - Fix additional formating issue >> - Don't use polymorphism and reformat code > > With the recent changes this ends up just

Re: RFR: 8315850: Improve AbstractMap anonymous Iterator classes

2023-09-07 Thread Rémi Forax
Java because usually classes that share >> implementation details are in the same package (or in the same nestmate >> nest). > > @forax Note that HashMap uses a similar subclassing idiom for the iterators > of the keySet, values, and entrySet collections in order to share th

Re: RFR: 8315850: Improve AbstractMap anonymous Iterator classes

2023-09-07 Thread Rémi Forax
On Thu, 7 Sep 2023 11:48:51 GMT, Per Minborg wrote: > This PR proposes to slightly improve some iterators of `AbstractMap`: > > * Code reuse > * A field declared `final` > * Add missing `@Override` annotations Hello, In Java, sharing code may have a runtime cost (or not) depending on the shape

Re: RFR: 8268829: Provide an optimized way to walk the stack with Class object only [v6]

2023-08-26 Thread Rémi Forax
On Fri, 25 Aug 2023 22:22:43 GMT, Mandy Chung wrote: >> 8268829: Provide an optimized way to walk the stack with Class object only >> >> `StackWalker::walk` creates one `StackFrame` per frame and the current >> implementation >> allocates one `StackFrameInfo` and one `MemberName` objects per

Re: RFR: 8268829: Provide an optimized way to walk the stack with Class object only [v6]

2023-08-26 Thread Rémi Forax
On Fri, 25 Aug 2023 22:22:43 GMT, Mandy Chung wrote: >> 8268829: Provide an optimized way to walk the stack with Class object only >> >> `StackWalker::walk` creates one `StackFrame` per frame and the current >> implementation >> allocates one `StackFrameInfo` and one `MemberName` objects per

Re: RFR: 8268829: Provide an optimized way to walk the stack with Class object only [v6]

2023-08-26 Thread Rémi Forax
On Fri, 25 Aug 2023 22:22:43 GMT, Mandy Chung wrote: >> 8268829: Provide an optimized way to walk the stack with Class object only >> >> `StackWalker::walk` creates one `StackFrame` per frame and the current >> implementation >> allocates one `StackFrameInfo` and one `MemberName` objects per

Re: RFE: Refactor java.util.Optional and add NonNull checks

2023-08-23 Thread Remi Forax
Sorry, you can not do that. Optional is a value based class [1] (see the javadoc) so the class has to be final. And more generally, the API of a classes of OpenJDK will not change based on some stylistic issue, OOP or not. regards, Rémi Forax [1] https://docs.oracle.com/en/java/javase

Re: RFR: 8266571: Sequenced Collections [v12]

2023-07-21 Thread Rémi Forax
On Fri, 21 Jul 2023 16:19:35 GMT, Hollis Waite wrote: > a SequencedCollection is backed by a doubly linked list. It's up to the user > to understand performance implications. Beware of this kind of thinking, implementations of collections in the JDK change. Many hashtable implementations in

Re: RFR: 8266571: Sequenced Collections [v12]

2023-07-21 Thread Rémi Forax
On Fri, 21 Jul 2023 11:16:11 GMT, Hollis Waite wrote: >> Stuart Marks has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 96 commits: >> >> - Merge branch 'master' into JDK-8266571-SequencedCollections >> - Optimizations for

Re: RFR: 8311943: Cleanup usages of toLowerCase() and toUpperCase() in java.base [v2]

2023-07-14 Thread Remi Forax
- Original Message - > From: "Uwe Schindler" > To: "core-libs-dev" , net-...@openjdk.org, > nio-...@openjdk.org, security-...@openjdk.org > Sent: Wednesday, July 12, 2023 6:08:17 PM > Subject: Re: RFR: 8311943: Cleanup usages of toLowerCase() and toUpperCase() > in java.base [v2] > On

Re: RFR: 8066869: Add Closeable::closeUnchecked that is the equivalent of close but throws UncheckedIOException

2023-07-08 Thread Remi Forax
oops, sorry, my bad, sending an email when you are deprived of sleep does not lead to a good outcome. Remi On July 7, 2023 4:40:53 PM UTC, Brian Burkhalter wrote: >On Fri, 7 Jul 2023 16:23:37 GMT, Remi Forax wrote: > >> I'm not a big fan of hiding exceptions, why

Re: RFR: 8066869: Add Closeable::closeUnchecked that is the equivalent of close but throws UncheckedIOException

2023-07-06 Thread Remi Forax
I'm not a big fan of hiding exceptions, why not wrapping the IOException in an UncheckedIOException ? So closeUnchecked() means close and throw an unchecked exception if an exception occurs. regards, Rémi - Original Message - > From: "Brian Burkhalter" > To: "core-libs-dev" > Sent:

Re: java.util.stream.Stream: API for user-extensible intermediate operations

2023-06-29 Thread forax
> From: "Viktor Klang" > To: "Remi Forax" > Cc: "core-libs-dev" > Sent: Thursday, June 29, 2023 11:09:22 AM > Subject: Re: java.util.stream.Stream: API for user-extensible intermediate > operations > From: Remi Forax > Sent: Thursday, 29 J

Re: java.util.stream.Stream: API for user-extensible intermediate operations

2023-06-29 Thread Remi Forax
> From: "Viktor Klang" > To: "core-libs-dev" > Sent: Tuesday, June 27, 2023 7:10:42 PM > Subject: java.util.stream.Stream: API for user-extensible intermediate > operations > Hi core-libs-dev, > Over the past 6+ months I've been thinking about, and tinkering with, how we'd > be able to expose

Re: RFR: 8306647: Implementation of Structured Concurrency (Preview) [v2]

2023-05-30 Thread Rémi Forax
o > - ... and 2 more: https://git.openjdk.org/jdk/compare/89f2d458...e92ba524 I've rewritten all my tests to use the new API, it works ! https://github.com/forax/loom-fiber/tree/java21 One surprising thing is that Subtask.get() give less leeway to the owner thread than to the other virtual

Re: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v20]

2023-05-26 Thread Rémi Forax
On Fri, 26 May 2023 06:07:05 GMT, Joe Darcy wrote: >> Jim Laskey has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Improving error recovery in presence of less important syntactic errors in >> top-level methods and fields. >> >>

Re: Classes used in method body are loaded lazily or eagerly depending on method return type

2023-05-23 Thread Remi Forax
- Original Message - > From: "David Holmes" > To: "Raffaello Giulietti" , "core-libs-dev" > > Sent: Wednesday, May 24, 2023 12:23:24 AM > Subject: Re: Classes used in method body are loaded lazily or eagerly > depending on method return type > On 24/05/2023 12:50 am, Raffaello

Re: Classes used in method body are loaded lazily or eagerly depending on method return type

2023-05-23 Thread Remi Forax
- Original Message - > From: "Сергей Цыпанов" > To: "core-libs-dev" > Sent: Tuesday, May 23, 2023 1:20:44 PM > Subject: Classes used in method body are loaded lazily or eagerly depending > on method return type > Hello, Hello, > > originally this question was asked here: >

Re: Exposing checked exceptions that a MethodHandle can throw

2023-05-21 Thread Remi Forax
- Original Message - > From: "-" > To: "core-libs-dev" > Sent: Sunday, May 21, 2023 6:52:44 AM > Subject: Exposing checked exceptions that a MethodHandle can throw > Hello, > I am eliciting a discussion on the feasibility of tracking checked > exceptions thrown by a MethodHandle. It is

Re: JEP 442: Foreign Function & Memory API => why is it again preview API?

2023-05-17 Thread forax
- Original Message - > From: "Uwe Schindler" > To: "Remi Forax" > Cc: "core-libs-dev" > Sent: Wednesday, May 17, 2023 9:13:35 AM > Subject: Re: JEP 442: Foreign Function & Memory API => why is it again > preview API? > Hi

Re: JEP 442: Foreign Function & Memory API => why is it again preview API?

2023-05-16 Thread Remi Forax
- Original Message - > From: "Uwe Schindler" > To: "core-libs-dev" > Sent: Tuesday, May 16, 2023 5:38:32 PM > Subject: JEP 442: Foreign Function & Memory API => why is it again preview > API? > Hi, Hi Uwe, > > yesterday Apache Lucene got the information that JDK 21 got the project >

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v16]

2023-05-08 Thread Rémi Forax
On Mon, 8 May 2023 10:46:34 GMT, Maurizio Cimadamore wrote: >> src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line >> 342: >> >>> 340: >>> 341: // individual handle fields >>> 342: clb.withField(ORIGINAL_TARGET_NAME, CD_MethodHandle, >>>

Re: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v9]

2023-05-05 Thread Rémi Forax
On Fri, 5 May 2023 17:35:33 GMT, Vicente Romero wrote: >> `Flags.MANDATED` on a class is currently enough to know if it's a unnamed >> class or not, but it's not enough for classes not produced by javac. > > good point Just to be clear, here, Flags.UNNAMED_CLASS is needed because an an unnamed

Re: RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v9]

2023-05-05 Thread Rémi Forax
On Fri, 5 May 2023 17:08:35 GMT, Vicente Romero wrote: >> Jim Laskey has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Recommended changes #2 > > src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java > line 3999: >

Re: The introduction of Sequenced collections is not a source compatible change

2023-05-05 Thread forax
ot; > To: "Ethan McCue" , "Raffaello Giulietti" > > Cc: "Remi Forax" , "Stuart Marks" > , > "core-libs-dev" > Sent: Friday, May 5, 2023 4:38:16 AM > Subject: Re: The introduction of Sequenced collections is not a source > c

Re: The introduction of Sequenced collections is not a source compatible change

2023-05-03 Thread forax
nference problem. Rémi - Original Message - > From: "Stuart Marks" > To: "Remi Forax" > Cc: "core-libs-dev" > Sent: Tuesday, May 2, 2023 2:44:28 AM > Subject: Re: The introduction of Sequenced collections is not a source > compatible

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v12]

2023-05-02 Thread Rémi Forax
On Tue, 2 May 2023 21:22:16 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 8291966: SwitchBootstrap.typeSwitch could be faster [v2]

2023-05-02 Thread Rémi Forax
On Tue, 17 Jan 2023 15:55:40 GMT, Jan Lahoda wrote: >> The pattern matching switches are using a bootstrap method >> `SwitchBootstrap.typeSwitch` to implement the jumps in the switch. >> Basically, for a switch like: >> >> switch (obj) { >> case String s when s.isEmpty() -> {} >> case

Re: RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v11]

2023-05-02 Thread Rémi Forax
On Mon, 1 May 2023 14:56:27 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

Re: RFR: 8291966: SwitchBootstrap.typeSwitch could be faster [v2]

2023-04-30 Thread Rémi Forax
On Tue, 17 Jan 2023 15:55:40 GMT, Jan Lahoda wrote: >> The pattern matching switches are using a bootstrap method >> `SwitchBootstrap.typeSwitch` to implement the jumps in the switch. >> Basically, for a switch like: >> >> switch (obj) { >> case String s when s.isEmpty() -> {} >> case

The introduction of Sequenced collections is not a source compatible change

2023-04-29 Thread Remi Forax
I've several repositories that now fails to compile with the latest jdk21, which introduces sequence collections. The introduction of a common supertype to existing collections is *not* a source compatible change because of type inference. Here is a simplified example: public static void

Re: RFR: 8300543 Compiler Implementation for Pattern Matching for switch [v5]

2023-04-24 Thread Rémi Forax
On Fri, 21 Apr 2023 16:25:04 GMT, Jan Lahoda wrote: >> This is the first draft of a patch for JEP 440 and JEP 441. Changes included: >> >> - the pattern matching for switch and record patterns features are made >> final, together with updates to tests. >> - parenthesized patterns are

Re: RFR: 8300543 Compiler Implementation for Pattern Matching for switch [v4]

2023-04-21 Thread Rémi Forax
On Fri, 21 Apr 2023 15:30:24 GMT, Maurizio Cimadamore wrote: >> Also, surprisingly, if I make C and D classes (instead of interfaces): >> >> class Test { >> sealed interface I permits C, D { } >> final class C implements I { } >> final class D implements I { } >> >> interface

Re: Draft: Deprecate toLowerCase()/toUpperCase() and provide locale insensitive alternative

2023-04-11 Thread Remi Forax
> From: "Glavo" > To: "core-libs-dev" > Sent: Tuesday, April 11, 2023 10:02:01 PM > Subject: Draft: Deprecate toLowerCase()/toUpperCase() and provide locale > insensitive alternative > Hi everyone, > A few months ago, I discussed in this mailing list[1] whether > toLowerCase()/toUpperCase()

Re: RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v8]

2023-04-06 Thread Rémi Forax
On Thu, 6 Apr 2023 18:33:29 GMT, Chen Liang wrote: >> As John Rose has pointed out in this issue, the current j.l.r.Proxy based >> implementation of MethodHandleProxies.asInterface has a few issues: >> 1. Exposes too much information via Proxy supertype (and WrapperInstance >> interface) >> 2.

  1   2   >