Avoid extra byte copy inside FileSystemImpl.readFileInternal#5730
Merged
Conversation
Member
Author
|
@franz1981 please take a look |
tsegismont
force-pushed
the
issue/5665
branch
from
October 15, 2025 14:50
1f55bbc to
0597246
Compare
Member
Author
|
@vietj PTAL I added a test with JMH. Here are the results on my machine. Latency
The advantage grows with file size. At 1 MB, Allocations per operation
From 4 KB up, At 128 B the gap is smaller, probably because of the fixed overhead (FileChannel/Path objects, ByteBuf header) dominates over the data copy. |
vietj
reviewed
Jun 19, 2026
Closes eclipse-vertx#5677 The improvement consists in creating the buffer upfront and using Netty API to read the file channel. Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
On my machine, the advantage grows with file size. At 1MB, using the Netty FileChannel method is nearly 2x faster and allocates half as much as the Files.readAllBytes approach. Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
tsegismont
added a commit
that referenced
this pull request
Jun 19, 2026
…6213) * Avoid extra byte copy inside FileSystemImpl.readFileInternal Closes #5677 The improvement consists in creating the buffer upfront and using Netty API to read the file channel. * Added ReadFileBenchmark On my machine, the advantage grows with file size. At 1MB, using the Netty FileChannel method is nearly 2x faster and allocates half as much as the Files.readAllBytes approach. --------- Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #5665
The improvement consists in creating the buffer upfront and using Netty API to read the file channel.