Conversation
|
A slightly earlier version of this change had the following performance measurements this benchmark included some other changes which are not related and and more WIP, so I have removed then from the PR I will run a benchmark on this overnight and post up when I can, but here are the stats for a full compile and a focus on the xsbt-dependency phase, which is the star |
|
fuller results Full performance figures, to 100 iterations of akka actor, As a highlight the 3 rows represent the baseline, this change with no args and this change with extra args "-Yclasspath-cache-enabled", "-Yclasspath-top-prefetch", "-Yclasspath-raw-jar", "-Yclasspath-raw-dir" The phases are (annoyingly) not ordered, but the highlights are ( based on the last 90 runs) |
|
removed the default setting of the jar cache, that was failing test |
|
The speedups here look great, but it will take some more time to polish and review is available to include in 2.12.3. I'm not sure about the motivation for using |
|
HI @retronym I was looking for something that would work in an IDE, and with our internal, highly customised, build environment, and to ensure that it will cope when we build direct to jar in scalac or via zinc via sbt/zinc#305 If you have a jar/zip file then we don't want to have it open as this fails for updates to the jar (in windows it blocks the update and in unix it misses the update), so Watcher seemed a simple solution. It also seems to be (from code inspection only) that the current FlatClassPath caching implementation is broken in the the internal cache is invalid I did have an alternate implementation that uses last modified time and size to verify but this requires verification at the re-use of the jar, so it in not uncommon for us to have around 500 jars on a compile classpath, and several of these dont end up getting accessed in the actual compile (e.g. you know that you will use rt.jar, but probably not jsse etc). Watcher is efficient and a simple callback API If we wait until the time that we need the content of the JAR then this means that there is less opportunity to spin this work onto a background thread, and scan the jar in advance. All of this can time is not currently captured by the benchmarks in this PR, but should benefit from parallelization, particularly when jars are on physical media or NAS We have had some discussion outside this forum, and I can see 4 reuse models, and there could be selected based on settings and pattern match for the classpath element. This would enable a comparison of the different mechanisms as for performance and complexity, and behaviour in different environments
4 is marginally faster and useful in non interactive environments where there is no external modification, like CI and command line builds, or when some of the jar are read only ( e.g. maven/ivy) As the classpath implementation is simpler than I started with it should be simple to provide the cache validation mechanism a mixin trait Any additions to this will have to wait for three weeks as I will have very limited network access for that time |
d7b47e7 to
43756dc
Compare
|
/rebuild |
| } | ||
| } | ||
| } | ||
| //class CachedLazyIndexedMapping[V <: Named] (miss : (String => Iterable[V]) ) |
There was a problem hiding this comment.
The commented out code. Did you overlook it or is it expected (the WIP PR)?
There was a problem hiding this comment.
this was an experiment - trying to optimise an access pattern, but I think it will be out of scope in this PR. I will delete when we get close to agreement on what is viable
There was a problem hiding this comment.
it will be removed in the next push.
It was to get around the access of a Seq[File/class etc] by name
e.g. for findClass
replaced by an optimisation in PackageInfo
class PackageInfo(val packageName: String, val list: ClassPathEntries, val files: Seq[FileEntryType], val packages: Seq[PackageEntryImpl]) {
lazy val filesByName: Map[String, AbstractFile] = files.map {
file => file.name -> file.file
}(collection.breakOut)
43756dc to
6a53f4b
Compare
…e, reduced CPU usage
6a53f4b to
e2196cd
Compare
|
Moving to 2.12.5 as Mike and I are still working on the design for these changes. |
|
needs rebase. tentatively moving to 2.12.6 milestone? |
|
I will focus on this (or maybe a replacement) now that the backend changes are merged |
|
@mkeskells: ping -- shall we close this in favor of the future replacement PR you mentioned? I'm trying to decrease the PR queue depth a bit |
|
closing for now. once activity resumes we're happy to reopen or pursue in a new PR, as appropriate. |
|
we can reuse this in the work that we are about to start, but the PR will not merge from here, so we can restart a new one when we have a proposal |
This PR provides a series of improvements to classpath handling
12% reduced CPU, 23% reduction in allocation overall based on the figures in comments below
I had intended to do some more work on the prior to PR but as @retronym opened #5956 it seems worthwhile to combine these 2 approaches