RFR: 8304020: Speed up test/jdk/java/util/zip/ZipFile/TestTooManyEntries.java and clarify its purpose

Eirik Bjorsnos duke at openjdk.org
Sun Mar 12 08:46:15 UTC 2023


Please review this test which speeds up TestTooManyEntries and clarifies its purpose:

- The name 'TestTooManyEntries' does not clearly convey the purpose of the test. What is tested here is the validation that the total CEN size fits in a Java byte array. Suggested rename: CenSizeTooLarge
- The test creates DEFLATED entries which incurs zlib costs and File Data / Data Descriptors for no additional benefit. We can use STORED instead.
- The name of entries is generated by calling UUID.randomUUID, we could use simple counter instead.
- The produced file is unnecessarily large. We know how large a CEN entry is, let's take advantage of that to create a file with the minimal size.
- The summary and comments of the test can be improved to help explain the purpose of the test and how we reach the limit being tested.

The speedups here reduced the runtime of this test from 6 min 58 sec to 3 min 35 sec on my Macbook pro. The produced ZIP size was reduced from 6000000098 bytes to 3655383762 bytes.

-------------

Commit messages:
 - Update copyright years
 - Speed up TestTooManyEntries, clarify its purpose and rename it to CenSizeTooLarge

Changes: https://git.openjdk.org/jdk/pull/12991/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12991&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8304020
  Stats: 175 lines in 2 files changed: 86 ins; 89 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/12991.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12991/head:pull/12991

PR: https://git.openjdk.org/jdk/pull/12991


More information about the core-libs-dev mailing list