grails (11) vaadin (11) meteor (6) java (4) elasticsearch (3) apple (2) centos (1) cloudbees (1) google analytics (1) gradle (1) heroku (1) javafx (1) javascript (1) jdbc (1) jug (1) logback (1) logging (1) mac os (1) management (1) mongodb (1) mongolab (1) mysql (1) twitter (1) ubuntu (1)

Thursday, November 12, 2015

Performance of Java 8 lambdas and anonymous inner classes

There is a study with 55 slides by Oracle showing the performance difference between lambda and anonymous inner classes.

The most important is this slide showing that lambda is slow during warm up and as fast as anonymous classes after JIT optimizes the performance.

It does NOT mean we should avoid using lambdas. Because they have quite few proposals and ideas for performance improvements (if you want to know what, see the study) and mainly because lambas are different to anonymous inner classes. So, it just means we need to wait after JVM gets optimized. And who knows, maybe lambdas are going to be faster than anonymous inner classes.

No comments:

Post a Comment