Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make caches in ExtractAPI use perRunCaches #324

Closed
jvican opened this issue Jun 28, 2017 · 1 comment
Closed

Make caches in ExtractAPI use perRunCaches #324

jvican opened this issue Jun 28, 2017 · 1 comment

Comments

@jvican
Copy link
Member

jvican commented Jun 28, 2017

This is a minor improvement. I believe we can have the caches created in ExtractAPI created and destroyed per run, to alleviate memory consumption on every compile. This is just a nicety, it can wait.

@jvican
Copy link
Member Author

jvican commented Jul 7, 2017

The goal of this ticket is to alleviate memory consumption of Scala's incremental compiler phases. It is not clear whether this is possible, so some small "research" by the user that takes this up will be required.

The idea is to go to ExtractAPI.scala and make the following maps and sets user perRunCaches, defined in the Scala compiler.

Maps and sets to migrate:

  // this cache reduces duplicate work both here and when persisting
  //   caches on other structures had minimal effect on time and cache size
  //   (tried: Definition, Modifier, Path, Id, String)
  private[this] val typeCache = new HashMap[(Symbol, Type), xsbti.api.Type]
  // these caches are necessary for correctness
  private[this] val structureCache = new HashMap[Symbol, xsbti.api.Structure]
  private[this] val classLikeCache = new HashMap[(Symbol, Symbol), xsbti.api.ClassLikeDef]
  private[this] val pending = new HashSet[xsbti.api.Lazy[_]]

  private[this] val emptyStringArray = new Array[String](0)

  private[this] val allNonLocalClassesInSrc = new HashSet[xsbti.api.ClassLike]
  private[this] val _mainClasses = new HashSet[String]

perRunCaches is defined in the SymbolTable: https://github.com/scala/scala/blob/2.12.x/src/reflect/scala/reflect/internal/SymbolTable.scala.

So your task is to define maps and sets using perRunCaches, see if there are problems and identify if these caches are forced to be persisted across all the compiler runs. This may scare you! But don't worry, it's simpler than it looks like. Have fun!

gheine pushed a commit to gheine/zinc that referenced this issue Jul 7, 2017
Duhemm added a commit that referenced this issue Jul 10, 2017
Make caches in 'ExtractAPI' use 'perRunCaches' #324
@jvican jvican closed this as completed Jul 10, 2017
cunei pushed a commit to cunei/zinc that referenced this issue Oct 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant