-
Notifications
You must be signed in to change notification settings - Fork 5k
Restored cache for the ZincScalaCompiler #12866
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
Conversation
@bot-gradle test RFM |
OK, I've already triggered ReadyForMerge build for you. |
@big-guy At first sight, I can't see how that cache breaks the reason for removing it in the first place. But I may be missing something. |
@ljacomet I'm +1 for fixing this. I should have added a perf test when I made this switch before. I'm -1 with fixing it in this way. There are a few problems:
I believe the actual problem is this classloader is not reused/cached: Line 85 in 4d87cd9
By caching the ZincScalaCompiler, we also reuse this classloader. If you change that code to...
I see a similar level of improvement. This is obviously the wrong kind of fix too, but I think it demonstrates that reusing that classloader has some impact. I suspect this may be something that the old zinc compiler was doing for us since we didn't worry about caching these things before. With 6.4-rc-2: https://e.grdev.net/s/cceccmm6swwxg/performance/execution 38 minutes of task execution (sorry, these are private links) I think a proper fix would be to limit the change to just caching this classloader. It would be nice if we had access to some of the infrastructure we have for this (e.g., Maybe we can do something a little simpler:
WDYT? |
I agree with all your points. I think I can prepare a better fix according to this guidelines. Unless someone else wants to tackle the issue. |
@SheliakLyr If you are willing to keep working on this, please do so. Otherwise I can't guarantee it will be done in the short term. |
17192e1
to
44bee9b
Compare
I've just pushed a new commit.
Currently, this branch contains "FixV2". Unfortunately performance is still worse than 5.6.x, but compared to 6.x improvement is significant! Keep in mind that my test-project is specifically designed to showcase the problem. In branch cachedScalaCompilerV4 you can see an additional improvement: private static final ClassLoaderCache ANALYZING_COMPILER_CLASSLOADER_CACHE =
new ClassLoaderCache(new URLClassLoader(new URL[0]));
/// ...
if (scalaCompiler instanceof AnalyzingCompiler) {
scalaCompiler = ((AnalyzingCompiler) scalaCompiler).withClassLoaderCache(ANALYZING_COMPILER_CLASSLOADER_CACHE);
} This is something I found while trying to speed up the compilation even further. Seems a little risky to include, as I haven't found any documentation about this cache usage. IMO, FixV2 should be good for now. Further optimizations can be be added later. |
Cc @retronym in case he has thoughts. |
Reverts part of 55cc646
Issue: #12591
Signed-off-by: Sheliak Lyr [email protected]
Fixes #12591
Context
Fixes performance regression introduced in version 6.0. See Issue #12591 for details.
Contributor Checklist
<subproject>/src/integTest
) to verify changes from a user perspective<subproject>/src/test
) to verify logic./gradlew <changed-subproject>:check
Gradle Core Team Checklist