Skip to content

Use BufferedOutputStream when writing the Zip file to improve performance#1580

Merged
Goooler merged 2 commits intoGradleUp:mainfrom
stuartwdouglas:stuartwdouglas/shadow-jar-buffering-9.x
Aug 5, 2025
Merged

Use BufferedOutputStream when writing the Zip file to improve performance#1580
Goooler merged 2 commits intoGradleUp:mainfrom
stuartwdouglas:stuartwdouglas/shadow-jar-buffering-9.x

Conversation

@stuartwdouglas
Copy link
Copy Markdown
Contributor

@stuartwdouglas stuartwdouglas commented Aug 4, 2025

When not using STORED entries use a BufferedOutputStream to avoid lots of small writes to the file system.

Testing this with a 300mb jar build I see the total build time going from 40s to 30s.

Note that it is not possible to do this with STORED entries as the implementation requires a RandomAccessFile to update the CRC after write.


  • CHANGELOG's "Unreleased" section has been updated, if applicable.

When not using STORED entries use a BufferedOutputStream to avoid lots of small writes to the file system.

Testing this with a 300mb jar build I see the total build time going from 40s to 30s.

Note that it is not possible to do this with STORED entries as the implementation requires a RandomAccessFile to update the CRC after write.
@stuartwdouglas
Copy link
Copy Markdown
Contributor Author

I didn't add a changelog entry for this as if the 8.x PR goes in a well then there are no changes compared to the 8.x branch.

@Goooler Goooler changed the title fix: use buffered writes for performance Use BufferedOutputStream when writing the Zip file to improve performance Aug 5, 2025
@Goooler Goooler enabled auto-merge (squash) August 5, 2025 02:08
@Goooler Goooler changed the title Use BufferedOutputStream when writing the Zip file to improve performance Use BufferedOutputStream when writing the Zip file to improve performance Aug 5, 2025
@Goooler Goooler merged commit 3290619 into GradleUp:main Aug 5, 2025
12 checks passed
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.

2 participants