rorygraves / scalac_perf

The Scala programming language
http://www.scala-lang.org/
16 stars 3 forks source link

Investigate/optimise Symbol.ownerChain #3

Open rorygraves opened 7 years ago

rorygraves commented 7 years ago

Uses of Symbol.ownerChain is a def that create a new list on each call. Potential to save quite a lot of garbage and work by creating specialised methods - (e.g. ownerCheckExists(Symbol => Boolean) )

Investigate usages and improve performance/garbage characteristics.

For example: GenSymbols.scala:74 ownerChain.tail.tail.exists

rorygraves commented 6 years ago

thoughts from random discussions: Might be a bit ugly, but might work nicely in the cases I was originally investigating

ownerCheckExists(startAtDepth: Int, f: Symbol => Boolean)

The original goals were to cut down on unneeded collection creation/memory churn rather than performance directly (although it can't hurt)