RFR 8245308 : Replace ThreadLocalCoders decoder/encoder cache in java.net.URI

Alan Bateman Alan.Bateman at oracle.com
Thu Aug 27 14:11:24 UTC 2020


On 27/08/2020 14:11, Rahul Yadav wrote:
> Hello,
>
> Request to have my fix reviewed for issue:
>
> JDK-8245308:  Replace ThreadLocalCoders decoder/encoder cache in 
> java.net.URI.
>
> This fix updates java.net.URI, replaces the ThreadLocalCoders 
> optimization.
> The benchmark results indicate no impact, optimization can be 
> replaced.The results of
> benchmark are provided below and benchmark included in webrev.
>
> Before
>
> Benchmark                      (iterations)  Mode  Cnt   Score Error  
> Units
> ThreadLocalURI.uriDecoderTest           100  avgt   25   0.258 ± 
> 0.014  us/op
> ThreadLocalURI.uriEncoderTest           100  avgt   25  35.540 ± 
> 1.082  us/op
>
> After
>
> Benchmark                      (iterations)  Mode  Cnt   Score Error  
> Units
> ThreadLocalURI.uriDecoderTest           100  avgt   25   0.247 ± 
> 0.005  us/op
> ThreadLocalURI.uriEncoderTest           100  avgt   25  37.231 ± 
> 0.669  us/op
>
>
> Issue:  https://bugs.openjdk.java.net/browse/JDK-8245308
> webrev: https://cr.openjdk.java.net/~ryadav/webrev_8245308/index.html
The quote method is creating the UTF-8 encoder eagerly, I guess I would 
expect it to only create this encoder when the input has non-ASCII 
chars, meaning it can be created lazily. Otherwise the change to URI 
looks okay to me.

For the micro, I'm curious if iterations is needed.

-Alan


More information about the net-dev mailing list