[foreign-memaccess+abi] Integrated: 8268266: Investigate way to lazily customize upcall lambda forms
Jorn Vernee
jvernee at openjdk.java.net
Fri Jun 11 18:31:10 UTC 2021
On Thu, 10 Jun 2021 10:02:48 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
> Hi,
>
> This patch makes upcall method handle customization lazy, which helps a lot in reducing the number of lambda form classes generated during for intstance the TestUpcall test, making it complete a lot faster.
>
> This adds a very slight overhead per call, since there's another indirection, but I think the tradeoff is acceptable.
>
> Since the patch was otherwise really small, this also adds a qsort benchmark that is also used the measure the cost of the extra indirection. Results are as follows:
>
>
> QSort without lazy customization:
>
> Benchmark Mode Cnt Score Error Units
> QSort.jni_upcall_qsort_naive avgt 30 21096.871 � 299.669 ns/op
> QSort.jni_upcall_qsort_optimized avgt 30 3603.495 � 16.464 ns/op
> QSort.native_qsort avgt 30 96.236 � 0.713 ns/op
> QSort.panama_upcall_qsort avgt 30 937.675 � 26.160 ns/op
>
> QSort with lazy customization:
>
> Benchmark Mode Cnt Score Error Units
> QSort.jni_upcall_qsort_naive avgt 30 21454.476 � 306.135 ns/op
> QSort.jni_upcall_qsort_optimized avgt 30 3691.395 � 35.671 ns/op
> QSort.native_qsort avgt 30 97.440 � 0.894 ns/op
> QSort.panama_upcall_qsort avgt 30 1072.929 � 14.948 ns/op
>
>
> So, while there is some regression from this change, it's not super bad (not integer factor), and I think the tradeoff is worth it to generate fewer lambda form classes, which of course has it's own overhead not visible in this benchmark.
>
> Thanks,
> Jorn
This pull request has now been integrated.
Changeset: ef8327da
Author: Jorn Vernee <jvernee at openjdk.org>
URL: https://git.openjdk.java.net/panama-foreign/commit/ef8327da2198b60be51e575a38503992ce63a727
Stats: 446 lines in 11 files changed: 387 ins; 52 del; 7 mod
8268266: Investigate way to lazily customize upcall lambda forms
Reviewed-by: mcimadamore
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/553
More information about the panama-dev
mailing list