about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2021-02-23 02:51:47 +0100
committerGitHub <noreply@github.com>2021-02-23 02:51:47 +0100
commit4af965e73262190137a86b44fc2f75da7fb54eab (patch)
tree8b4fe6abf3e045534c80c7771b860f77b6eb1337 /compiler/rustc_codegen_llvm/src
parent5d90e89c36468350b9636614b0f9dbf64a4aef80 (diff)
parent33d8b0456876181883f8d97997a3a0a6e9ff652f (diff)
downloadrust-4af965e73262190137a86b44fc2f75da7fb54eab.tar.gz
rust-4af965e73262190137a86b44fc2f75da7fb54eab.zip
Rollup merge of #81837 - gilescope:to_ascii_speedups, r=dtolnay
Slight perf improvement on char::to_ascii_lowercase

`char::to_ascii_lowercase()` was checking if it was ascii and then if it was in the right range. Instead propose to check once (I think removing a compare and a shift in the process: [godbolt](https://godbolt.org/z/e5Tora) ).

before:
```
        test char::methods::bench_to_ascii_lowercase                    ... bench:      11,196 ns/iter (+/- 632)
        test char::methods::bench_to_ascii_uppercase                    ... bench:      11,656 ns/iter (+/- 671)
```
after:
```
         test char::methods::bench_to_ascii_lowercase                    ... bench:       9,612 ns/iter (+/- 979)
         test char::methods::bench_to_ascii_uppercase                    ... bench:       8,241 ns/iter (+/- 701)
```

(calling u8::to_ascii_lowercase and letting that flip the 5th bit is also an option, but it's more instructions. I'm thinking for things around ascii and char we want to be as efficient as possible.)
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions