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

8338931: ZipEntry.flag could be made internal to ZipOutputStream #20702

Closed
wants to merge 3 commits into from

Conversation

eirbjo
Copy link
Contributor

@eirbjo eirbjo commented Aug 24, 2024

Please review this refactoring PR which moves the ZipEntry.flag field back to ZipOutputStream.XEntry.

Moving this field will save four bytes from the ZipEntry object size and also saves an unneccessary read in ZipFile.getZipEntry.

Testing:

This PR is a refactoring of existing code and does not update any tests. I added the label noreg-cleanup to the JBS issue.

The following runs clean:

make test TEST="test/jdk/java/util/zip"
make test TEST="test/jdk/java/util/jar"

Performance:

The JMH benchmark java.util.zip.ZipFileGetEntry.getEntryHit show a small but consistent improvement (2-3%).


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8338931: ZipEntry.flag could be made internal to ZipOutputStream (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20702/head:pull/20702
$ git checkout pull/20702

Update a local copy of the PR:
$ git checkout pull/20702
$ git pull https://git.openjdk.org/jdk.git pull/20702/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 20702

View PR using the GUI difftool:
$ git pr show -t 20702

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20702.diff

Webrev

Link to Webrev Comment

Sorry, something went wrong.

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 24, 2024

👋 Welcome back eirbjo! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Aug 24, 2024

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Aug 24, 2024

@eirbjo The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Aug 24, 2024
@eirbjo eirbjo marked this pull request as ready for review August 24, 2024 12:47
@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 24, 2024
@mlbridge
Copy link

mlbridge bot commented Aug 24, 2024

Webrevs

@LanceAndersen
Copy link
Contributor

I need to spend some more time thinking about this, but I can ask what made you decide to look at this?

Changing the field name from flag -> flags then becomes a bit confusing as for example its usage in initCEN and the name of CENFLG. The field is also used via ZipInputStream (not via ZipEntry but flag). So some thought needs to be given to the naming

Similar comment for ZipFileSystem as if we move forward, then we need to be consistent in naming otherwise it becomes (or can be) confusing for future maintainers.

Also the Zip Spec refers to the field as "general purpose bit flag" and the zlib repository includes a minzip, which also references this field as flag which might be another reason to keep the field name as is regardless of it moving to XEntry

@eirbjo
Copy link
Contributor Author

eirbjo commented Aug 25, 2024

Sorry, the renaming was just an accident, It was “flags” in my head, but that was wrong.

Will revert the rename once I’m in front of a keyboard again in a few days.

The reason I’m looking at this is that ZipEntry is 88 bytes, and allocation is a significant cost when enumerating and looking up entries. So it would be beneficial to move unused or optional parts out of these common read paths. This seemed like a small but obvious win.

@eirbjo eirbjo changed the title 8338931: ZipEntry.flags could be made internal to ZipOutputStream 8338931: ZipEntry.flag could be made internal to ZipOutputStream Aug 27, 2024
@bridgekeeper
Copy link

bridgekeeper bot commented Sep 25, 2024

@eirbjo This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 23, 2024

@eirbjo This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

@bridgekeeper bridgekeeper bot closed this Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

None yet

2 participants