I assume the JIT isn't optimizing until the functions execute a certain number of times. Given the speed difference maybe it isn't even natively compiling at first and using the interpreter.
I don't know about Java but in .NET there's a call you can make to force the dynamically generated lamba expression to be compiled immediately.
Of course if you're being really adventurous you can use IL emit to build a function up from IL opcodes.
I don't know about Java but in .NET there's a call you can make to force the dynamically generated lamba expression to be compiled immediately.
Of course if you're being really adventurous you can use IL emit to build a function up from IL opcodes.