Not only that, but when writing to disk it’s actually going to a RAM buffer. So it’s almost as fast anyway.
Right. In the disk method, the disk driver is performing at least a partial concatenation before actually writing to disk. The disk driver has more efficient code for concatenation than the code generated by Java (no surprise there) or Python.