We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The following code:
#[allow(non_upper_case_globals)] struct DrSeuss; impl DrSeuss { const Thing1: u8 = 0; const Thing2: u8 = 1; } #[kani::proof] fn main() { let mut haystack = [DrSeuss::Thing1; 100]; let needle = DrSeuss::Thing2; haystack[kani::any_where(|idx: &usize| *idx < 100)] = needle; let mut i = 0; let mut count = 0; while i < 100 { if haystack[i] == needle { count += 1; } assert!(count < 2); i += 1; } }
Is faster than the following code:
#[repr(u8)] #[derive(Copy, Clone, Eq, PartialEq)] enum DrSeuss { Thing1, Thing2, } #[kani::proof] fn main() { let mut haystack = [DrSeuss::Thing1; 100]; let needle = DrSeuss::Thing2; haystack[kani::any_where(|idx: &usize| *idx < 100)] = needle; let mut i = 0; let mut count = 0; while i < 100 { if haystack[i] == needle { count += 1; } assert!(count < 2); i += 1; } }
This difference scales, and if you add an extra 0, it is 2 seconds difference on my machine.
It appears that the generated code, which I'm looking at through --gen-c, keeps a "struct" and never uses the u8 layout.
Kani version: 0.54.0
The text was updated successfully, but these errors were encountered:
The first code snippet appears to have some copy&paste problem, can you please check the first line?
Sorry, something went wrong.
@tautschnig fixed
No branches or pull requests
The following code:
Is faster than the following code:
This difference scales, and if you add an extra 0, it is 2 seconds difference on my machine.
It appears that the generated code, which I'm looking at through --gen-c, keeps a "struct" and never uses the u8 layout.
Kani version: 0.54.0
The text was updated successfully, but these errors were encountered: