boxing + unboxing a VT is not a no-op ?

forax at univ-mlv.fr forax at univ-mlv.fr
Wed Jul 18 15:07:14 UTC 2018


----- Mail original -----
> De: "Tobias Hartmann" <tobias.hartmann at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "valhalla-dev" <valhalla-dev at openjdk.java.net>
> Envoyé: Mercredi 18 Juillet 2018 13:28:48
> Objet: Re: boxing + unboxing a VT is not a no-op ?

> Thanks, I've filed a bug [1] and have a fix ready.

thanks for fixing it :)

> 
> Here are the results with the patched JVM:
> 
> Benchmark                                                        Mode  Cnt
> Score     Error  Units
> ReifiedListBenchMark.arraylist_integer_get                       avgt    9
> 0.065 ±   0.010  ms/op
> ReifiedListBenchMark.reifiedlist_intbox_get                      avgt    9
> 593.495 ± 106.121  ms/op
> ReifiedListBenchMark.valuelist_intbox_get                        avgt    9
> 0.033 ±   0.007  ms/op
> ReifiedListBenchMark.valuelist_intbox_inlined_reduce             avgt    9
> 0.030 ±   0.002  ms/op
> ReifiedListBenchMark.valuelist_intbox_innervalue_inlined_reduce  avgt    9
> 0.029 ±   0.001  ms/op
> ReifiedListBenchMark.valuelist_intbox_reduce                     avgt    9
> 0.033 ±   0.009  ms/op
> 

nice :)

about the bug, the summary is only about java.lang.Object, but the VM should not do buffering/boxing if it's an interface too.

> Best regards,
> Tobias
> 
> [1] https://bugs.openjdk.java.net/browse/JDK-8207773

Rémi

> 
> On 17.07.2018 17:11, forax at univ-mlv.fr wrote:
>> The jar is test-fr.umlv.valuetype-1.0.jar, it has dependencies to JUnit 5 and
>> JMH
>> 
>> Every jars are here:
>> http://www-igm.univ-mlv.fr/~forax/tmp/valhalla/
>> 
>> you can run it like this:
>> /usr/jdk/jdk-11-lworld/bin/java -XX:+EnableValhalla --module-path
>> path_to_the_folder_that_contains_the_jars -m
>> fr.umlv.valuetype/fr.umlv.valuetype.perf.ReifiedListBenchMark
>> 
>> regards,
>> Rémi
>> 
>> ----- Mail original -----
>>> De: "Tobias Hartmann" <tobias.hartmann at oracle.com>
>>> À: "Remi Forax" <forax at univ-mlv.fr>
>>> Cc: "valhalla-dev" <valhalla-dev at openjdk.java.net>
>>> Envoyé: Mardi 17 Juillet 2018 16:58:41
>>> Objet: Re: boxing + unboxing a VT is not a no-op ?
>> 
>>> Hi Remi,
>>>
>>> okay, thanks for the details. Could you maybe upload the jmh benchmark .jar? I
>>> have problems to
>>> build the entire benchmark suite from scratch and I cannot reproduce the
>>> performance difference when
>>> extracting the benchmark methods and running them manually.
>>>
>>> Thanks,
>>> Tobias
>>>
>>> On 17.07.2018 16:14, forax at univ-mlv.fr wrote:
>>>> when i run the benchmark,
>>>>
>>>> Benchmark                                                        Mode  Cnt
>>>> Score    Error  Units
>>>> ReifiedListBenchMark.arraylist_integer_get                       avgt    9
>>>> 0.055 ±  0.001  ms/op
>>>> ReifiedListBenchMark.reifiedlist_intbox_get                      avgt    9
>>>> 506.190 ±  7.978  ms/op
>>>> ReifiedListBenchMark.valuelist_intbox_get                        avgt    9
>>>> 0.027 ±  0.001  ms/op
>>>> ReifiedListBenchMark.valuelist_intbox_inlined_reduce             avgt    9
>>>> 0.027 ±  0.001  ms/op
>>>> ReifiedListBenchMark.valuelist_intbox_innervalue_inlined_reduce  avgt    9
>>>> 0.304 ±  0.004  ms/op
>>>>
>>>> if you compare valuelist_intbox_get and valuelist_intbox_inlined_reduce you see
>>>> that a value type that contains an int as as fast as an int, that's great but
>>>> i'm more interested by the last two benchmarks.
>>>>
>>>> valuelist_intbox_innervalue_inlined_reduce should be as fast as
>>>> valuelist_intbox_inlined_reduce, because the only difference is value type to
> >>> object boxing.


More information about the valhalla-dev mailing list