Skip to content

Apply the readAllBytes() optimization to deflated nested jar entries - #52285

Merged
philwebb merged 2 commits into
spring-projects:mainfrom
janwaleed09:nested-jar-inflater-read-all-bytes
Oct 18, 2026
Merged

philwebb merged 2 commits into
spring-projects:mainfrom
janwaleed09:nested-jar-inflater-read-all-bytes

Conversation

@janwaleed09

Copy link
Copy Markdown
Contributor

The readAllBytes() override from 059525f is only in JarEntryInputStream, but class entries are normally deflated and go through JarEntryInflaterInputStream, which still uses the default implementation with a 16 KB buffer and a copy. I added the same override to ZipInflaterInputStream and made both read only the remaining bytes, since the current one throws EOFException after a partial read. Allocation until ApplicationReadyEvent goes down from 651 MB to 442 MB for PetClinic and from 540 MB to 354 MB for a sample app, and startup time didn't change measurably.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 18, 2026
@philwebb philwebb added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 18, 2026
@philwebb philwebb added this to the 4.2.0-RC1 milestone Oct 18, 2026
@philwebb philwebb self-assigned this Oct 18, 2026
janwaleed09 and others added 2 commits October 18, 2026 15:45
Align the exception message used in the earlier optimization.

See spring-projectsgh-52285
@philwebb
philwebb force-pushed the nested-jar-inflater-read-all-bytes branch from 03d6631 to d8bebfd Compare October 18, 2026 22:46
@philwebb
philwebb merged commit 57a1ca3 into spring-projects:main Oct 18, 2026
2 of 3 checks passed
@philwebb

Copy link
Copy Markdown
Member

Thanks @janwaleed09!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants