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
[NETBEANS-3693] Create only one instance of javac #1890
Conversation
…e files when refactored
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some initial comments. Please note that at least the "org.netbeans.modules.java.source.parsing.JavacParserTest" appears to be failing.
java/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java
Outdated
Show resolved
Hide resolved
java/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java
Outdated
Show resolved
Hide resolved
@@ -415,9 +422,28 @@ private void parseImpl( | |||
break; | |||
default: | |||
init (snapshot, task, false); | |||
DiagnosticListener<JavaFileObject> diagnosticListener; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hoping this could work in such a way that if the processing of the files does not fit into memory, it would fall back to the slow "one javac per file". It is not as good as current nb-javac, but I hope it would work reasonably OK. Would also be good to have some tests for that.
java/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java
Outdated
Show resolved
Hide resolved
java/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java
Outdated
Show resolved
Hide resolved
…e files when refactored
There is one test case failing - testMultiSourceVanilla |
Right - but that means the test needs to be fixed (or removed), correct? I.e. we cannot have failing tests, I assume? |
Yes, will do that. |
…e files when refactored
Currently, without nb-javac, refactoring run file-by-file (one javac instance per file), which increases chances it fits into the memory. This patch changes that to one javac instance for all files in the refactoring - that significantly improves the speed, but lowers the chances the processing will fit into the memory. I still think a middle ground - try to fit all into the memory, and run fast if it fits, but fallback to file-by-file processing if it doesn't - is the best combination. And, unless I am mistaken, this patch does not provide that. |
I don't think there is a significant overlap between these PRs - this PR is (as far as I can tell) speeding up refactoring. #2013 is fixing the refactoring.java tests+adding them into the Travis configuration. |
…e files when refactored
@@ -419,15 +425,15 @@ private void parseImpl( | |||
init (snapshot, task, false); | |||
DiagnosticListener<JavaFileObject> diagnosticListener; | |||
JavacTaskImpl javacTask; | |||
if (sequentialParsing == null && ciImpl == null) { | |||
if (sequentialParsing == null && ciImpl == null && this.snapshotSize <= (5<<20)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please declare it as constant like THRESHOLD_SIZE or similar ot that
@ebarboni probably better to stick with what we've been testing with and push this back to 12.1? |
I guess I was hoping the processing would adjust dynamically (i.e. the processing would switch to file-by-file if it would run out of memory). Anyway - my proposal is to add an option to enable this and push (after master opens), so that we can test in practice. |
By an option, I mean a command line option like -J-Djava.enable.single.javac=true; which can be tested using Boolean.getBoolean("java.enable.single.javac"). |
…e files when refactored
5c8d535
to
d945405
Compare
What's the status on this one? @lahodaj safe to merge for 12.1? |
Sorry, but the builds say there is some problem with the patch - could you please investigate? Thanks! |
At this point in time, think we need to bump this to 12.2. |
96129ee
to
d945405
Compare
[NETBEANS-3693] Create only one instance of javac for parsing multiple files when refactored