3 ms·
Cap'n Proto is only sortof-mutable. You can update e.g. an integer in-place, but if you want to change anything that is variable-width, e.g. modifying a string,
by kentonv 5y ago
Cap'n Proto is only sortof-mutable. You can update e.g. an integer in-place, but if you want to change anything that is variable-width, e.g. modifying a string, adding/removing inner objects, etc., then it can get awkward. New objects will be added to the end of the buffer, and removed objects will just be zero'd out, wasting the memory. You can "garbage-collect" by making a whole-tree copy, of course.
But yeah all the stuff about untrusted data is BS. NoProto's readme lists "Safely handle untrusted data" as an advantage vs. every other format it compares against, including Protobuf and JSON. What? Every serious serialization format supports untrusted data.
- kentonv 5y agoNote that Cap'n Proto's mutability limitations are inherent to being a zero-copy protocol -- it's necessary to allocate messages in contiguous memory, tightly packed, which makes it hard to be able to allocate memory dynamically. NoProto also claims to be zero-copy, which would seem to subject it to the same issues. I couldn't find anything in the docs explaining how they avoid it.