diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2014-02-16 16:11:47 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2014-02-18 21:55:53 +1100 |
| commit | a68d10e6adc048b3a5f90e376f232a39223d1db8 (patch) | |
| tree | 9c97b3429fd7e79aa88c7ecaaa51151475ac0253 /src/rustllvm/PassWrapper.cpp | |
| parent | c8489069b43191c5298f17430933b3b88fb79c3c (diff) | |
| download | rust-a68d10e6adc048b3a5f90e376f232a39223d1db8.tar.gz rust-a68d10e6adc048b3a5f90e376f232a39223d1db8.zip | |
std::str: safen and optimize is_utf8.
This uses a vector iterator to avoid the necessity for unsafe indexing,
and makes this function slightly faster. Unfortunately #11751 means that
the iterator comes with repeated `null` checks which means the
pure-ASCII case still has room for significant improvement (and the
other cases too, but it's most significant for just ASCII).
Before:
is_utf8_100_ascii ... bench: 143 ns/iter (+/- 6)
is_utf8_100_multibyte ... bench: 134 ns/iter (+/- 4)
After:
is_utf8_100_ascii ... bench: 123 ns/iter (+/- 4)
is_utf8_100_multibyte ... bench: 115 ns/iter (+/- 5)
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
