Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Chunk compression field a char[4] #32

Closed
jhurliman opened this issue Jan 21, 2022 · 1 comment
Closed

Make Chunk compression field a char[4] #32

jhurliman opened this issue Jan 21, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@jhurliman
Copy link
Contributor

jhurliman commented Jan 21, 2022

Right now, the compression field in Chunk is a variable-length string. This places the actual chunk payload at a variable offset, and requires parsing the compression string to determine the chunk payload length. If compression was instead a fixed-length char[4], we would know the chunk payload size immediately after parsing the record length and it would avoid an additional allocation for the std::string compression.

uncompressed would be [0x00, 0x00, 0x00, 0x00] or little-endian uint32_t 0
lz4 would be [0x6C, 0x7A, 0x34, 0x00] or little-endian uint32_t 3439212
zstd would be [0x7A, 0x73, 0x74, 0x64] or little-endian uint32_t 1685353338

@jhurliman jhurliman added the bug Something isn't working label Jan 21, 2022
@defunctzombie
Copy link
Contributor

After discussion we've decided to stick with string. We were not swayed enough yet that this is annoying enough to require a new type to reason about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants