groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Sun (JIRA)" <j...@apache.org>
Subject [jira] [Created] (GROOVY-9072) Avoid creating inner classes for simple native lambda expressions
Date Sat, 06 Apr 2019 13:19:00 GMT
Daniel Sun created GROOVY-9072:
----------------------------------

             Summary: Avoid creating inner classes for simple native lambda expressions
                 Key: GROOVY-9072
                 URL: https://issues.apache.org/jira/browse/GROOVY-9072
             Project: Groovy
          Issue Type: Improvement
            Reporter: Daniel Sun
            Assignee: Daniel Sun


Groovy will create inner classes for each native lambda expression because native lambda
expression is versatile and mimic the behavior of closure as possible as it can.

As a result, the performance of native lambda expression will be a bit less efficient than
Java lambda expression.

We can generate almost same bytecode for the simple native lambda expressions, e.g. no re-assignment
of shared variables in the lambda expression body, no nested lambda expression.

 The improvement can cover most of usual cases, e.g.
{code:java}
Stream.of(1, -2, 3).map(e -> Math.abs(e))
{code}




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message