News for hackers. Stuff that matters.
Re:Byte Buddy – runtime code generation for the JVM by raphw on Wednesday March 04, 2015 @09:34AM (#9144410)
Byte Buddy is quite efficient. It is more or less like implementing Java code per hand. Byte Buddy comes along with a benchmark where the results are listed here: http://bytebuddy.net/#/tutorial

This way, it even beats the use of MethodHandles for accessing fields which still have a slight overhead over "normal" field access: https://gist.github.com/raphw/881e1745996f9d314ab0

Of course, there might be a flaw in the benchmark, those are tricky. Si please challange it, I am always interested in such details. I also guess, that the advantage will decrease with future JVMs.

Re:Byte Buddy – runtime code generation for the JVM by the8472 on Wednesday March 04, 2015 @11:15AM (#9145220)
Afaik method handles need to be assigned to final fields (with -XX:+TrustFinalNonStaticFields) or final static fields for the JIT to be able to inline them.
Re:Byte Buddy – runtime code generation for the JVM by raphw on Thursday March 05, 2015 @04:30AM (#9149901)
You are right, it is stated here: https://wiki.openjdk.java.net/display/HotSpot/Deconstructing...

I will update and rerun the benchmark some time. Unfortunately, storing a value in a static final field allows the VM to pre-determine the entire method call and to erase the invocation altogether. This makes it hard to measure the impact of the method call. It is also questionable if this is the desired measurement as reflection is normally used to delay a call site determination to runtime which could not be done using a MethodHandle in a static final field.

But really good catch! I will hava a look at it some time soon.