On Wed, 18 Jun 2025 00:04:37 GMT, Brian Burkhalter <b...@openjdk.org> wrote:

> Replaces the implementation `readAllCharsAsString().lines().toList()` with 
> reading into a temporary `char` array which is then processed to detect line 
> terminators and copy non-terminating characters into strings which are added 
> to the list.

The throughput of the implementation as measured by the included benchmark 
appears to hover around 13% greater than that of the existing method. The 
updated method should also have a smaller memory footprint for streams of 
non-trivial length as it does not first create a single intermediate `String` 
containing all lines in the stream. Instead it uses a `char` array of size 8192 
and a `StringBuilder` whose maximum length will be the length of the longest 
line in the input.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25863#issuecomment-2982169343

Reply via email to