charslaw / Pando

Pando serializes and tracks the history of a state tree
MIT License
2 stars 0 forks source link

Consider null terminated string primitive serializer #50

Open schultzcole opened 2 years ago

schultzcole commented 2 years ago

This primitive serializer would serialize a string with a given encoding while signaling the end of the string with a null byte (rather than storing the length of the string in the serialized value).

This serializer would trade off storage space for deserialization time. The current string serializer takes 1 int's worth of bytes to store the length, while the null terminated string serializer would take just 1 byte for the sentinel value. The null terminated string would need to loop through the buffer first to identify the end of the string before parsing it. (maybe it could parse and look for the sentinel in one loop?)