hi all, is there a performance hit when method ref...
# announcements
l
hi all, is there a performance hit when method reference is used vs lambda?
a
Assuming you're comparing something like:
Copy code
runSomething(::blah)
runSomething { blah() }
Then not really - view the byte code and you can see they both generate a new inner class that just invokes the original function
I think if you target Java 8 then the reference might use invoke dynamic or something fancy instead which might be more efficient, though not 100% sure on that
d
I thought invoke dynamic was only added in Java 9 or a later version 🤔
p
Java 8 - lambdas are based on it
l
thanks all