Traversing an array of value types seen as an array of Object is slow

Roland Westrelin rwestrel at redhat.com
Thu Jun 28 07:31:24 UTC 2018


Hi Rémi,

> I maybe wrong with the conclusion but this benchmark [1] show that there is something fishy.
>
> Benchmark                                         Mode  Cnt    Score    Error  Units
> ReifiedListBenchMark.arraylist_integer_get        avgt    9    0.068 ±  0.001  ms/op
> ReifiedListBenchMark.arraylist_integer_iterator   avgt    9    0.069 ±  0.001  ms/op
> ReifiedListBenchMark.reifiedlist_intbox_cursor    avgt    9  516.526 ± 11.903  ms/op
> ReifiedListBenchMark.reifiedlist_intbox_get       avgt    9  523.149 ±  9.194  ms/op
> ReifiedListBenchMark.reifiedlist_intbox_iterator  avgt    9  514.091 ± 18.357  ms/op
>
> A reified list uses an array created by reflection and seen as an Object[].
> The creation and the population of the array is done out-of-the-band and not benchmarked,
> the benchmark only test several ways to access to the array in a loop.
>
> It seems that the JIT never try to optimize the loop for whatever
> reason so the loop is done by the interpreter and only the access to
> the array cell is JITed.

Thanks for reporting the issue. I'm taking a look.

Roland.



More information about the valhalla-dev mailing list