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

[FS] Copy small files using InputStream.transferTo() #1502

Conversation

HannesWell
Copy link
Member

Follow-up on #1471 to not use java.nio.file.Files.copy() for small files because it's slower in that case.

With #1475 InputStream.transferTo() is used, which is optimized from Java-17 to 21 in case a FileInputStream is transferred to a FileOutputStream to perform the copy using FileChannels.
In my experiments the latter method and Files.copy() had approximately similar performance in the area of 1MiB large files, while Files.copy() became faster with further growing file-size and was significantly faster for 1GiB files.
Since Eclipse-Platform probably requires Java-21 soonish, using 1MiB as threshold seemed to be a good compromise for me.

@HannesWell HannesWell force-pushed the use-stream-transfer-for-small-files branch from 7940380 to 3197654 Compare August 13, 2024 21:59
Copy link
Contributor

Test Results

 1 734 files  ±0   1 734 suites  ±0   1h 25m 22s ⏱️ + 1m 26s
 3 973 tests ±0   3 951 ✅ ±0   22 💤 ±0  0 ❌ ±0 
12 516 runs  ±0  12 355 ✅ ±0  161 💤 ±0  0 ❌ ±0 

Results for commit 3197654. ± Comparison against base commit 27ff234.

@HannesWell HannesWell merged commit 63a314e into eclipse-platform:master Aug 14, 2024
16 checks passed
@HannesWell HannesWell deleted the use-stream-transfer-for-small-files branch August 14, 2024 18:24
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.

1 participant