Skip to content
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

Added a system property, that enables the zip file cache for larger f… #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Frontrider
Copy link

…iles.

If I understood it correctly, than line 253 recieves the uri of the jar file, which turns into a zipfilesystem under the hood.
I added a system property to set the proper environmental values. It's a system property, so that people who don't need it don't need to bother, and to make it plug into loom as is, without modifications.

CI servers can set the property when required.

@@ -244,7 +244,13 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
}

if (fs == null) {
fs = FileSystems.newFileSystem(uri, Collections.emptyMap());
Map<String, Object> env = new HashMap<>();
if(System.getProperty("tiny_use_zipcache","FALSE").equals("TRUE")){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do people use lowercase or uppercase for values more often?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better yet, use lowercase and call toLowerCase on the property value. Furthermore, System.getProperty is null if the property isn't present, so this will crash with an NPE if the property isn't specified.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't do that, because I give a default value to be used when it's not present. I can set it to lowercase.

Although, it's only a partial fix, because it still runs out of memory, but it's no longer because of the zipfs.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion is to use "tiny.useZipCache"

Also - don't forget Boolean.getBoolean() 😉

@sfPlayer1
Copy link
Collaborator

Can you elaborate on the benefits? Any measurements?

@Frontrider
Copy link
Author

It crashes on our ci server when it tries to load up the entire archive, as it runs out of memory. We can't give it more. Modmuss benchmarked it, the entire gradle build should use 1.1G, but 1.5 is not enough.

It fixes that issue, but then it starts to do the same as it makes byte buffers that are too large, So we might need a different fix.

zml2008 pushed a commit to zml2008/tiny-remapper that referenced this pull request Aug 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants