3 ms·
I would like to see more use of netstrings - https://en.wikipedia.org/wiki/Netstring https://en.wikipedia.org/wiki/Netstring
by hawski 10y ago
I would like to see more use of netstrings - https://en.wikipedia.org/wiki/Netstring https://en.wikipedia.org/wiki/Netstring
- jstimpfle 10y agoThis is a bad idea. What you want from text logs is the possibility to start anywhere in the file, look for a nearby newline and know it is the start of a record. This is a very important property. It's also what makes UTF-8 resilient.
- hawski 10y agoWhy can't I have both? I am not against text logs, but it is good to have options. When binary format is an option I say that netstrings are probably better option.
- jstimpfle 10y agoFor literal binary data you need to store the length information separately. Netstrings are one option for ephemeral streams. But they are a bad tradeoff for persistent information: you have to read from the beginning of the stream until you find the relevant information. And a single corrupted byte destroys all the information after it. Better options for persistent data are (pointer+length)s or memory-pools + ranges.