sbt/project
Mark Harrah 5dc671c7f8 Synchronize ClassLoaderCache and the Scala provider cache.
Construction of Scala providers was already properly synchronized jvm and machine-wide.
The cache on top of construction was not and neither was the newer ClassLoaderCache.
This could cause the same Scala version to be loaded in multiple class loaders, taking
up more permgen space and possibly decreasing performance due to less effective jit.

The issue is very rare in practice for 0.13 because of the low probability of contention
on ClassLoaderCache.  This is because the work for a cache miss is mainly the construction
of a URLClassLoader.  In 0.12, however, the work potentially involved network access and
class loading (not just class loader construction), thus greatly increasing the probability
of contention and thus duplicate work (i.e. class loader construction).

When there is contention, multiple class loaders are constructed and then preserved by the
scalaInstance task in each project throughout the first task execution.  Only when multiple
scalaInstance tasks execute simultaneously and only during the first execution does this occur.
(Technically, it could still happen later, but it doesn't in practice.)

This means that the number of duplicate class loaders should quickly saturate instead of growing
linearly with the number of projects.  It also means that the impact depends on the exact
tree structure of projects.  A linear chain of dependencies will be unaffected, but a build with
independent leaves may be limited by the number of cores.  The number of cores affects
the number of threads typically used by the task engine, which limits the number of concurrently
executing scalaInstance tasks.

In summary, this might affect the first, cold compilation of a multi-module project with
independent leaves on a multi-core machine with Scala version different from the version used
for sbt.  It might increase the maximum permgen requirements as well as slow the jit compilation
by up to one task execution.  Subsequent compilations should be unaffected and the permgen
utilization return to be as expected.
2013-06-19 21:38:06 -04:00
..
Docs.scala -Ymacro-no-expand for API docs 2013-02-13 08:13:50 -05:00
Proguard.scala remove JLine from the launcher 2013-02-26 09:27:56 -05:00
Release.scala switch dispatch to dispatch.classic to avoid collisions with plugins which use newer versions of dispatch (0.9+) 2013-02-19 08:54:56 -05:00
Sbt.scala Synchronize ClassLoaderCache and the Scala provider cache. 2013-06-19 21:38:06 -04:00
Status.scala stamp-version should fail if current version is a release 2013-06-03 10:36:21 -04:00
Sxr.scala -Ymacro-no-expand for API docs 2013-02-13 08:13:50 -05:00
Transform.scala remove task key definition from the build since it is now in sbt 2013-06-19 17:14:57 -04:00
Util.scala preparation for 0.13.0-Beta1 2013-06-01 10:56:30 -04:00
build.properties build with 0.12.4-RC2 2013-06-05 19:55:24 -04:00
p.sbt switch dispatch to dispatch.classic to avoid collisions with plugins which use newer versions of dispatch (0.9+) 2013-02-19 08:54:56 -05:00