rust: Convert cheap debug_asserts into soft_asserts - #38172
Open
def- wants to merge 1 commit into
Open
Conversation
antiguru
approved these changes
Aug 12, 2026
antiguru
left a comment
Member
There was a problem hiding this comment.
Seems fine. Not all asserts are free, but if measurements don't turn up any regression I'm OK with accepting them.
| impl Ord for Top1Monoid { | ||
| fn cmp(&self, other: &Self) -> Ordering { | ||
| debug_assert_eq!(self.order_key, other.order_key); | ||
| mz_ore::soft_assert_eq_no_log!(self.order_key, other.order_key); |
Member
There was a problem hiding this comment.
Potentially expensive, but as we're allocating two vectors just next, I don't mind this cost.
| /// (time, data)-order, to ensure the chain remains sorted. | ||
| fn push_chunk(&mut self, chunk: Chunk<D>) { | ||
| debug_assert!(self.can_accept_chunk(&chunk)); | ||
| mz_ore::soft_assert_no_log!(self.can_accept_chunk(&chunk)); |
Member
There was a problem hiding this comment.
Potentially expensive, and checks a precondition. Accept.
Contributor
Author
Benchmarks in CI run with soft assertions off, so the overhead for them should just be a quick check of whether soft assertions are on, not the actual assertion body. |
def-
force-pushed
the
pr-soft-assert
branch
2 times, most recently
from
August 12, 2026 12:39
5170dba to
688eb3b
Compare
Contributor
Author
|
I'll wait a day before merging in case anyone wants to veto. |
debug asserts are only available in cargo test, soft asserts are also enabled in our e2e tests in CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
debug asserts are only available in cargo test, soft asserts are also enabled in our e2e tests in CI
Nightly run: https://buildkite.com/materialize/nightly/builds/18058 (failures are unrelated and just fixed on main)