Re: RFR: 8215412: Optimize PrintStream.println methods

2019-01-04 Thread Claes Redestad
On 2019-01-04 17:39, Claes Redestad wrote: I'll mull a bit about a succinct comment, but at least the version history will point to this RFE.. Lest I hear any objections, I'll push with this comment added to the two new writeln methods: // Used to optimize away back-to-back flushing and s

Re: RFR: 8215412: Optimize PrintStream.println methods

2019-01-04 Thread Roger Riggs
+1 Thanks On 01/04/2019 02:40 PM, Claes Redestad wrote: On 2019-01-04 17:39, Claes Redestad wrote: I'll mull a bit about a succinct comment, but at least the version history will point to this RFE.. Lest I hear any objections, I'll push with this comment added to the two new writeln metho

Re: RFR: 8215412: Optimize PrintStream.println methods

2019-01-04 Thread Claes Redestad
On 2019-01-04 16:55, Roger Riggs wrote: Oops, missed a revision. Looks good, Thanks! > though the reader may puzzle a while about why. I'll mull a bit about a succinct comment, but at least the version history will point to this RFE.. /Claes

Re: RFR: 8215412: Optimize PrintStream.println methods

2019-01-04 Thread Claes Redestad
On 2019-01-04 16:46, fo...@univ-mlv.fr wrote: The perf diff is more that what i was expected :) Looks good to me ! Thanks! /Claes

Re: RFR: 8215412: Optimize PrintStream.println methods

2019-01-04 Thread Roger Riggs
ot; , "core-libs-dev" Envoyé: Vendredi 4 Janvier 2019 16:38:06 Objet: Re: RFR: 8215412: Optimize PrintStream.println methods Hi Claes, The logic looks fine, but the 'internal' field name doesn't mean anything and there's no description of the optimization. The field

Re: RFR: 8215412: Optimize PrintStream.println methods

2019-01-04 Thread forax
The perf diff is more that what i was expected :) Looks good to me ! Rémi - Mail original - > De: "Claes Redestad" > À: "Remi Forax" > Cc: "core-libs-dev" > Envoyé: Mercredi 2 Janvier 2019 21:32:09 > Objet: Re: RFR: 8215412: Optimize Pri

Re: RFR: 8215412: Optimize PrintStream.println methods

2019-01-04 Thread Remi Forax
Hi Roger, the field has disappear in the latest webrev. Rémi - Mail original - > De: "Roger Riggs" > À: "Claes Redestad" , "core-libs-dev" > > Envoyé: Vendredi 4 Janvier 2019 16:38:06 > Objet: Re: RFR: 8215412: Optimize PrintStream.prin

Re: RFR: 8215412: Optimize PrintStream.println methods

2019-01-04 Thread Roger Riggs
Hi Claes, The logic looks fine, but the 'internal' field name doesn't mean anything and there's no description of the optimization. The field could be renamed:  noOverride or notOverridden or noDoubleSync or ... or add a comment to the field describing its purpose. Update copyright date on Pr

Re: RFR: 8215412: Optimize PrintStream.println methods

2019-01-02 Thread Claes Redestad
Hi again, as expected not much of a difference on the test I was using (a small cost on the startup/warmup numbers due replacing a boolean check with a method call), but on a test that adds in a few extended PrintStreams and mixes those with use of System.out I can get a ~3-4% statistical improve

Re: RFR: 8215412: Optimize PrintStream.println methods

2019-01-02 Thread Claes Redestad
Hi Rémi, On 2019-01-02 13:05, Remi Forax wrote: Hi Claes, did you try instead of having a field 'internal' to inline the class check (this.getClass() == PrintStream.class) at every call site you are reading that field ? for a method like println(), the VM has to do a class check (if CHA is

Re: RFR: 8215412: Optimize PrintStream.println methods

2019-01-02 Thread Remi Forax
ibs-dev" > > Envoyé: Mercredi 2 Janvier 2019 09:44:20 > Objet: Re: RFR: 8215412: Optimize PrintStream.println methods > Hi, > > new webrev: > > http://cr.openjdk.java.net/~redestad/8215412/jdk.02/ > > - Adds a forgotten String.valueOf in println(String), makin

Re: RFR: 8215412: Optimize PrintStream.println methods

2019-01-02 Thread Claes Redestad
Hi, new webrev: http://cr.openjdk.java.net/~redestad/8215412/jdk.02/ - Adds a forgotten String.valueOf in println(String), making sure all methods are semantically the same for - Remove the isInternal method and use only exact match with PrintStream.class to determine whether to use the optimi

Re: RFR: 8215412: Optimize PrintStream.println methods

2018-12-14 Thread Claes Redestad
Hi, On 2018-12-14 19:06, Roger Riggs wrote: Hi Claes, 611: Can't the loop break after finding the first \n? shouldn't have been a loop there at all (and yes, in the pre-existing version breaking after finding the first \n should be ok) 916: I'd probably call writeln(String.valueOf(x)) and

Re: RFR: 8215412: Optimize PrintStream.println methods

2018-12-14 Thread Roger Riggs
Hi Claes, 611: Can't the loop break after finding the first \n? 916: I'd probably call writeln(String.valueOf(x)) and skip the extra method call. Is there any benefit of doing the String conversions before the synchronized block? As is in the old code for println(Object x). There isn't much

RFR: 8215412: Optimize PrintStream.println methods

2018-12-14 Thread Claes Redestad
Hi, the various PrintStream.println methods are inefficient: nested synchronization, multiple flushes and a scan of the input string for newlines that in the end is pointless in this context since newLine will always flush anyway (if autoflush is enabled). While performance of printing to cons