about summary refs log tree commit diff
path: root/src/rustllvm/PassWrapper.cpp
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2014-02-16 17:12:47 +1100
committerHuon Wilson <dbau.pp+github@gmail.com>2014-02-18 21:55:53 +1100
commita39056e614b61489a8b8afc4171586e454d4dcbd (patch)
tree912512ec2337e40e7772c40592c22cbbf33e3fee /src/rustllvm/PassWrapper.cpp
parenta68d10e6adc048b3a5f90e376f232a39223d1db8 (diff)
downloadrust-a39056e614b61489a8b8afc4171586e454d4dcbd.tar.gz
rust-a39056e614b61489a8b8afc4171586e454d4dcbd.zip
std: convert first_non_utf8_byte to use the iterator.
This makes it very slightly faster, especially when the string is valid
UTF-8, and completely removes the use of `unsafe` from the first half.

Before:

    from_utf8_lossy_100_ascii              ... bench:       151 ns/iter (+/- 17)
    from_utf8_lossy_100_invalid            ... bench:       447 ns/iter (+/- 33)
    from_utf8_lossy_100_multibyte          ... bench:       135 ns/iter (+/- 4)
    from_utf8_lossy_invalid                ... bench:       124 ns/iter (+/- 10

After:

    from_utf8_lossy_100_ascii              ... bench:       119 ns/iter (+/- 8)
    from_utf8_lossy_100_invalid            ... bench:       454 ns/iter (+/- 16)
    from_utf8_lossy_100_multibyte          ... bench:       116 ns/iter (+/- 9)
    from_utf8_lossy_invalid                ... bench:       119 ns/iter (+/- 9)
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions