-
Notifications
You must be signed in to change notification settings - Fork 87
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
Split compression size threshold from compressor #113
Conversation
min int | ||
} | ||
|
||
// WithCompressMinBytes sets a minimum size threshold for compression: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not crazy about the name, but I can't really think of a better one. Maybe CompressThresholdBytes
, but I'm assuming you thought of that. "compress min bytes" reads to me as "compress at least this number of bytes no matter what", which obviously doesn't make sense (what if I have less than that number of bytess?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WithCompressionThreshold
?
Right now, it matches WithReadMaxBytes
. If we change, should the two continue to match?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know here - I feel like they're slightly different, ReadMaxBytes
says "error if you read more than this", while this option says "if you cross this number, don't do an action" - I think I'm being pedantic, you might have it right. Maybe it should be ReadMaxBytes
and CompressMinBytes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WithUncompressedSmallMessages(threshold int)
?
I'm indifferent, you pick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No you. Lol.
WithCompressMinBytes is fine
I feel that this is an important and obvious optimization to allow users
to configure. After talking to @bufdev about #108, though, I'm convinced
that we should split it into a separate option from the compressor
itself and default to a less-surprising value.