On 28/09/2024 18:15, Markus Karg wrote:
- Applications could use Apache Commons IO's CharSequenceReader. As it is an
open-source third-party dependency, some authors might not be allowed to use
it, or may not want to carry this additional burden just for the sake of
this single performance improvement. In addition, this library is not very
actively maintained; its Java baseline still is Java 8. There is no
commercial support.

As someone who has provided some PRs for the project, I can tell you it's actively maintained. There have been 4 minor versions in 2023 and 2 in 2024. It probably still targets Java 8 because that's still a maintained LTS version. The library is generic enough to be useful even on Java 8.
(The commercial support is a valid comment though.)

- Instead of adding special cases for
"String/StringBuilder/StringBuffer::getChars()", we could add
"getChars(char[], int, int)" as a new default method to the CharSequence
interface, essentially providing a char-by-char loop for all CharSequence
implementations not already having an optimized getChars method. This makes
the implementation of CharSequenceReader simpler, as not "switch over
instanceof" is needed to benefit from optimized "getChars" implementations.

As the developer that added the if-statements using getChars for CharSequenceReader 5 years ago, I applaud this. In fact, I have already suggested this almost 4 years ago: https://mail.openjdk.org/pipermail/core-libs-dev/2020-November/071149.html. Unfortunately I can't find my changes anywhere so this would need to be rewritten.


Kind regards,

Rob

Reply via email to