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

Split compression size threshold from compressor #113

Merged
merged 3 commits into from
Mar 2, 2022
Merged

Conversation

akshayjshah
Copy link
Member

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.

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.
@akshayjshah akshayjshah requested a review from bufdev March 2, 2022 18:01
min int
}

// WithCompressMinBytes sets a minimum size threshold for compression:
Copy link
Member

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?)

Copy link
Member Author

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?

Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

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

handler.go Outdated Show resolved Hide resolved
@akshayjshah akshayjshah merged commit 843aca3 into main Mar 2, 2022
@akshayjshah akshayjshah deleted the ajs/compressors branch March 2, 2022 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants