comment out the invariants check for zero_padded_buffer, it's too expensive

This commit is contained in:
Christian Schwarz
2024-04-23 12:01:09 +00:00
parent 842474f2d1
commit a57fee334f

View File

@@ -20,8 +20,11 @@ impl<const N: usize> Default for Buf<N> {
impl<const N: usize> Buf<N> {
#[inline(always)]
fn invariants(&self) {
debug_assert!(self.written <= N, "{}", self.written);
debug_assert!(self.allocation[self.written..N].iter().all(|v| *v == 0));
// don't check by default, unoptimized is too expensive even for debug mode
if false {
debug_assert!(self.written <= N, "{}", self.written);
debug_assert!(self.allocation[self.written..N].iter().all(|v| *v == 0));
}
}
pub fn as_zero_padded_slice(&self) -> &[u8; N] {