DAI 2023-2024 - Java IOs benchmarking - Loïc Herman #60
Closed
Lutonite
started this conversation in
Show and tell
Replies: 1 comment
-
Great! The only thing I would add is regarding the scientific methodology of this process: as we have insights about the performance of our code using the benchmarking, we can use the same approach to check if the performance of our application still is performant for a given use-case in the future. This is very important and valuable to have tangible metrics to share, discuss and compare with different iterations. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
https://github.com/Lutonite/heig-dai-2023-pw/tree/main/pw-io-benchmark
Benchmark
Times below are in milliseconds.
Writing
Reading
Conclusion
As we can see, unbuffered access to large files starts to slow down the process quite a bit.
This is due to the fact that the OS has to read the file byte by byte, which is a very slow process.
Buffered access is much faster, as it reads the file in larger chunks, which allows to reduce the amount of times
the file is accessed.
As such, buffered access is much faster than unbuffered access for larger files, and should be used
whenever possible. Unbuffered access can be used when the file is small enough, as the difference
in speed is not as noticeable.
The difference between binary and text access is not as noticeable, as the file is read in the same way,
but for text data there is an additional layer that translates the binary content to encoded character sequences,
using the character set specified.
Character encoding is the process of mapping a sequence of bytes to a sequence of characters.
Conversely, character decoding is the process of mapping a sequence of characters to a sequence of bytes.
When encoding characters, it is important to specify the character set to use, as the same sequence of bytes
can be interpreted differently depending on the character set used.
Beta Was this translation helpful? Give feedback.
All reactions