Skip to content

Avoid allocation of TreeInfo.Applied#8859

Merged
lrytz merged 1 commit intoscala:2.12.xfrom
retronym:faster/isSelfOrSuperConstructuctorCall
Apr 6, 2020
Merged

Avoid allocation of TreeInfo.Applied#8859
lrytz merged 1 commit intoscala:2.12.xfrom
retronym:faster/isSelfOrSuperConstructuctorCall

Conversation

@retronym
Copy link
Member

@retronym retronym commented Apr 6, 2020

While profiling a build I noticed that calls to disectApplied
via isSelfOrSuperConstrCall was an allocation hotspot.

These use cases only need to strip Apply/TypeApply, so in this
commit I've duplicated a few lines of code to to this.

While profiling a build I noticed that calls to disectApplied
via `isSelfOrSuperConstrCall` was an allocation hotspot.

These use cases only need to strip Apply/TypeApply, so in this
commit I've duplicated a few lines of code to to this.
@scala-jenkins scala-jenkins added this to the 2.12.12 milestone Apr 6, 2020
@retronym retronym added the performance the need for speed. usually compiler performance, sometimes runtime performance. label Apr 6, 2020
@retronym
Copy link
Member Author

retronym commented Apr 6, 2020

I hadn't seen this hotspot in previous compiler profiling. Perhaps that was because the JVM's escape analysis works in the setup we have in compiler-benchmark, but in the real-world build I was profiing it didn't work?

Perhaps Class Heirarchy Analysis marks dissectApplied as effectively final in the former but the latter has macros the trigger classloading of JavaUniverse$treeInfo$?

I also marked def dissectApplied and class Applied final in this PR to make HotSpot's life easier.

I'd still propose we live with the small amount of code duplication (disssectCore) rather than investigating how to make escape analysis work for us in all the hot call sites.

@retronym
Copy link
Member Author

retronym commented Apr 6, 2020

/rebuild

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

Labels

performance the need for speed. usually compiler performance, sometimes runtime performance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants