On Wed, 8 Nov 2023 15:45:56 GMT, Konrad Windszus <d...@openjdk.org> wrote:
> I know, but for memory consumption reasons everyone should prefer just > passing an InputStream. Is the memory consumption with > `ClassFile.of().parse(Path)` any better (i.e. are you using a > `java.io.RandomAccessFile` or `java.nio.channels.SeekableByteChannel` under > the hood)? I think that deserves a sentence in the javadoc. FYI `parse(Path)` is just a shortcut to read all bytes from a file, like `parse(Files.readAllBytes(path))`. Classfile implementation fetches the byte array very often (constant pool reading, lazy expansion) so keeping the bytes in a in-memory array is better. ------------- PR Comment: https://git.openjdk.org/jdk/pull/15706#issuecomment-1802967277