kellabyte/rewind

Add varint support

kellabyte opened this issue · 2 comments

The current layout of a Rewind log entry is as follows.

---------------------------------------
Bytes | Description
---------------------------------------
1       Flags
4       Seconds since the Unix epoch
3       Machine identifier
2       Process id
3       Counter, starting with a random value
4       Size in bytes of log data (uint32, max value of 4,294,967,295)
N       Log entry data

It may be a good space optimization for the 6th field of 4 bytes that stores the length of the log entry data to be stored as a varint instead.

If I understand correctly, the idea here is that log entries containing less than 2MB (2^21 bytes) of data will use 3 bytes (or less) to store the size of their data. How would you (or me, if I want to write the code) go about measuring the performance impact?

Closing because the project has changed direction.