Skip to content

Make ASCII case conversions more than 4× faster #59283

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

Merged
merged 11 commits into from
Mar 28, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ASCII uppercase: add "subtract shifted bool" benchmark
  • Loading branch information
SimonSapin committed Mar 19, 2019
commit c1ec29ace000ce4c733cde6948c87f9bc2370691
12 changes: 12 additions & 0 deletions src/libcore/benches/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,18 @@ benches! {
}
}

fn case13_subtract_shifted_bool_match_range(bytes: &mut [u8]) {
fn is_ascii_lowercase(b: u8) -> bool {
match b {
b'a'...b'z' => true,
_ => false
}
}
for byte in bytes {
*byte -= (is_ascii_lowercase(*byte) as u8) << 5
}
}

@iter

is_ascii,
Expand Down