Skip to content

Dehoist many closures from Types#8771

Merged
lrytz merged 1 commit intoscala:2.12.xfrom
hrhino:topic/dehoist
Apr 3, 2020
Merged

Dehoist many closures from Types#8771
lrytz merged 1 commit intoscala:2.12.xfrom
hrhino:topic/dehoist

Conversation

@hrhino
Copy link
Contributor

@hrhino hrhino commented Feb 29, 2020

Back in the day, hoisting used to reduce allocations and classfile size; now it does the opposite. Clean up accordingly.

Back in the day, hoisting used to reduce allocations and classfile size;
now it does the opposite. Clean up accordingly.
@hrhino hrhino requested a review from diesalbla February 29, 2020 01:55
@scala-jenkins scala-jenkins added this to the 2.12.12 milestone Feb 29, 2020
Copy link
Member

@dwijnand dwijnand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, niiicee.

@diesalbla
Copy link
Contributor

@hrhino For my information, what has changed ever since? Is it a progress on the Scala compiler or on the JVM implementations?

@hrhino
Copy link
Contributor Author

hrhino commented Feb 29, 2020

@diesalbla in 2.11-, lambdas desugared to (more or less) anonymous classes, so each use would create a new object. Now, lambdas use Java 8's LambdaMetaFactory, which caches a single lambda object at the call site if possible (i.e., the lambda expression doesn't capture any variables) and in either case doesn't require a new classfile per.

@SethTisue
Copy link
Member

(let's wait on merging until after 2.12.11 is out the door)

@lrytz lrytz merged commit 83f768f into scala:2.12.x Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants