RFR: 8215412: Optimize PrintStream.println methods
forax at univ-mlv.fr
forax at univ-mlv.fr
Fri Jan 4 15:46:13 UTC 2019
The perf diff is more that what i was expected :)
Looks good to me !
Rémi
----- Mail original -----
> De: "Claes Redestad" <claes.redestad at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "core-libs-dev" <core-libs-dev at openjdk.java.net>
> Envoyé: Mercredi 2 Janvier 2019 21:32:09
> Objet: Re: RFR: 8215412: Optimize PrintStream.println methods
> 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
> improvement with your idea - so I think it's better to peel off
> the PrintStream.class check like this:
>
> http://cr.openjdk.java.net/~redestad/8215412/jdk.03/
>
> Thanks!
>
> /Claes
>
> On 2019-01-02 13:29, Claes Redestad wrote:
>> 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
>>> defeated) before entering the method println so the JIT might be able
>>> to remove the check this.getClass() == PrintStream.class because it
>>> already know at that point that the current class is PrintStream.
>>
>> interesting idea - I'll try it out. I don't expect it to make much of a
>> difference in my current (trivial) tests, but perhaps in a slightly more
>> contrived setup.
>>
>> happy new year!
>>
> > /Claes
More information about the core-libs-dev
mailing list