Comment by Ygg2

Comment by Ygg2 2 days ago

4 replies

You have a read buffer and somewhere where you have to write to.

Even if we pretend that the read buffer is not allocating (plausible), you will have to allocate for the write source for the general case (think GiB or TiB of XML or JSON).

lelanthran 2 days ago

> You have a read buffer and somewhere where you have to write to.

The "somewhere you have to write to" is the same buffer you are reading from.

  • Ygg2 2 days ago

    Not if you are doing buffered reads, where you replace slow file access with fast memory access. This buffer is cleared every X bytes processed.

    Writing to it would be pointless because clears obliterate anything written; or inefficient because you are somehow offsetting clears, which would sabotage the buffered reading performance gains.

    • lelanthran 2 days ago

      Maybe I missed it, but ITT we were talking about C buffers, not buffered reads.

      • Ygg2 2 days ago

        I thought we were talking about high performance parsing. Of which buffered reads are one. Other is loading entire document into mutable memory, which also has limitations.