Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

retronym
Copy link
Member

@retronym retronym commented Mar 12, 2018

#6314 introduced classpath caching for compiler plugins and macros, and enabled it by default. This PR switches the default in order to be conservative in a 2.12 minor release.

Currently, the only caching strategy is last-modified, which checks the last modified date of the JAR file. Caching can be enabled using -Ycache-plugin-class-loader:last-modified / -Ycache-macro-class-loader:last-modified

Change the relevant settings to be evolvable into a policy selection rather than just a on/off toggle.

And change the relevant settings to be evolvable into a policy
selection rather than just a on/off toggle.
@scala-jenkins scala-jenkins added this to the 2.12.6 milestone Mar 12, 2018
@retronym retronym requested review from lrytz and jvican and removed request for lrytz March 12, 2018 11:53
@retronym retronym modified the milestones: 2.12.6, 2.12.5 Mar 12, 2018
@retronym
Copy link
Member Author

The main rationale here is that when we merged #6314 we didn't consider the risk of exposing concurrency bugs or memory leaks due to the sharing of state in top level objects (aka Java statics) across a cached classloader, which could be used in parallel or held onto for a long time.

We should enable caching by default in 2.13.x, but do so with a good release note for macro and plugin authors showing how to avoid problems, and perhaps incorporating with a time-based invalidation of cached classloaders.

The UI change is trying to incorporate #6381.

@retronym retronym requested a review from lrytz March 12, 2018 11:57
object None extends CachePolicy("none", "Don't cache class loader")
object LastModified extends CachePolicy("last-modified", "Cache class loader, using file last-modified time to invalidate")
// TODO Jorge to add new policy. Think about whether there is a benefit to the user on offering this as a separate policy or unifying with the previous one.
// object ZipMetadata extends CachePolicy("zip-metadata", "Cache classloade, using file last-modified time, then ZIP file metadata to invalidate")
Copy link
Member

Choose a reason for hiding this comment

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

👍 Sounds good to me!

@lrytz lrytz added the release-notes worth highlighting in next release notes label Mar 12, 2018
@lrytz lrytz merged commit 66070c5 into scala:2.12.x Mar 12, 2018
@lrytz lrytz added 2.12 and removed 2.12 labels Mar 14, 2018
neko-kai added a commit to 7mind/sbtgen that referenced this pull request Nov 4, 2019
…(however, this supposedly breaks macros with global mutable state...)

scala/scala#6412
https://twitter.com/olafurpg/status/1191299377064824832
> The caching logic for compiler plugins is enabled by default in Bloop and that one does make a difference,
  around 20/30%, see scala/scala-dev#458
neko-kai added a commit to 7mind/sbtgen that referenced this pull request Nov 4, 2019
* renames for Project fields

* Disable eta-sam lint scala/bug#11644

* Enable compiler plugin & macro classloader caching for faster builds (however, this supposedly breaks macros with global mutable state...)

scala/scala#6412
https://twitter.com/olafurpg/status/1191299377064824832
> The caching logic for compiler plugins is enabled by default in Bloop and that one does make a difference,
  around 20/30%, see scala/scala-dev#458

* Don't use -Xsource: since it's not recommended scala/bug#11661

* fix Ybackend-parallelism option

* empty `enabled` default parameter for  Plugins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes worth highlighting in next release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants