I just finished the first prototype, which can be found at https://gist.github.com/DasBrain/7766bedfbc8b76ba6a0ee66a54ba97ed - it contains a patch, the javap output of a generated proxy class with and without that patch, and the code I used to dump the proxy class. "make run-test-tier1" passes all JDK tests with the patch. I hope this will help the discussion a bit.

Good start.

https://mail.openjdk.java.net/pipermail/core-libs-dev/2019-August/061923.html

But there were never a real discussion about the benefits yet. It's good that we have one now.

As I am a novice JMH user, I don't trust myself to write good benchmarks that actually measure what I want to measure, not confirm what I would like it to be

Right, I think that's the next step.  You need to design an experiment to measure the cost of the <clinit> here.  I suspect the best way is to lift that work to an instance method (one that just overwrites the fields), and benchmark that, for various numbers of reflective calls.  Then we can separately measure the cost of spinning the bytecode for a proxy, and of loading the class from a cached byte[].  This will give us a sense of the relative costs of the various pieces, to validate that reducing the <clinit> cost is relevant.

Finally, we can benchmark the current approach against the LDC approach on a per-Method basis.  The LDC approach may well be doing more work per Method, so it's a tradeoff to determine whether deferring that work is a win.


Reply via email to