-
Notifications
You must be signed in to change notification settings - Fork 125
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
cache JrtFileSystem in ClasspathJrt.jrtFileSystem #2815 #2837
Conversation
...clipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/JrtFileSystem.java
Show resolved
Hide resolved
Since the change is not small, I'd very much appreciate a description of your strategy. What is being improved and how? |
Don't know what it not clear: instead of calling JRTUtil.method(File, ... ) i outlined and used JRTUtil.method(JrtFileSystem, ... ). The JrtFileSystem used is eager created in advance in the constructor ClasspathJrt(String zipFilename) and stored in ClasspathJrt.jrtFileSystem instead of just the Filename "jrtFile. Then it can be reused in subsequent calls. For example in the heavy used ClasspathJrt.isPackage(). |
initially, when looking at the PR "nothing" is clear, since we can't read the intentions inside your head :)
I don't see "instead", but "additionally / optionally", meaning that only one client of
ok
thanks, that explains the other "big" change :) FYI, I'm asking these questions mainly so we better know what's going on when later we have to revisit this code in another bug report. |
Regarding the batch compiler it seems straight forward to add a batch.ClasspathJrt.jrtFileSystem but i don't understand how/if it should be used as argument for |
have you seen Also, looking at |
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.
Thank you Jörg for this one.
I think this is going into the right direction.
...clipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/JrtFileSystem.java
Show resolved
Hide resolved
} | ||
|
||
public static void walkModuleImage(File image, String release, final JRTUtil.JrtFileVisitor<Path> visitor, int notify) throws IOException { | ||
JrtFileSystem system = getJrtSystem(image, release); | ||
public static void walkModuleImage(JrtFileSystem system, JRTUtil.JrtFileVisitor<Path> visitor, int notify) throws IOException { |
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.
Is it really necessary to keep these static methods that just call a similarly named method on the first argument here and below?
Some handle the case where the JRTFileSystem
is null, but I wonder if that would be better handled by the caller?
And some don't even do null-checks and just call the corresponding method on JRTFileSystem
.
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 suggest you answer that question yourself by looking into the call hierarchy.
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.
If I do that I see that one just has to change the visibility of the called method to public and then the same question arises, plus should that method not be public (together with the corresponding other methods)?
But in general, since I patiently answer your question and address your remarks on my PRs, I was hoping that you would return the favor and answer my questions/remarks on your PRs.
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.
There are 4 callers. i don't see a benefit to add the null check to all of them.
e74f916
to
7b046d0
Compare
to avoid ephemeral memory allocations eclipse-jdt#2815
they store release in ClasspathJep247.compliance, but never call getJrtSystem. i don't get why batch compiler have two different "ClasspathJrt" implementations.
I don't see a problem in the source code but i have never used or even measured the batch compiler in any way. I will add a commit for changes that can be similar done in batch compiler - without knowing how big the benefit will be there. |
…ipse-jdt#2815 to avoid ephemeral memory allocations eclipse-jdt#2815
7b046d0
to
085f0cd
Compare
to avoid ephemeral memory allocations
#2815