summary refs log tree commit diff
path: root/src/libextra/hex.rs
AgeCommit message (Collapse)AuthorLines
2013-09-25rustdoc: Change all code-blocks with a scriptAlex Crichton-4/+4
find src -name '*.rs' | xargs sed -i '' 's/~~~.*{\.rust}/```rust/g' find src -name '*.rs' | xargs sed -i '' 's/ ~~~$/ ```/g' find src -name '*.rs' | xargs sed -i '' 's/^~~~$/ ```/g'
2013-09-05Rename str::from_bytes to str::from_utf8, closes #8985Florian Hahn-3/+3
2013-08-06Result::get -> Result::unwrapSteven Fackler-6/+6
2013-08-06Removed convenience encoding trait implsSteven Fackler-70/+22
Encoding should really only be done from [u8]<->str. The extra convenience implementations don't really have a place, especially since they're so trivial. Also improved error messages in FromBase64.
2013-08-06Removing space for NULL terminatorSteven Fackler-2/+1
String NULL terminators are going away soon, so we may as well get rid of this now so it doesn't rot.
2013-08-06ToBase64 and ToHex perf improvementsSteven Fackler-6/+8
The overhead of str::push_char is high enough to cripple the performance of these two functions. I've switched them to build the output in a ~[u8] and then convert to a string later. Since we know exactly the bytes going into the vector, we can use the unsafe version to avoid the is_utf8 check. I could have riced it further with vec::raw::get, but it only added ~10MB/s so I didn't think it was worth it. ToHex is still ~30% slower than FromHex, which is puzzling. Before: ``` test base64::test::from_base64 ... bench: 1000 ns/iter (+/- 349) = 204 MB/s test base64::test::to_base64 ... bench: 2390 ns/iter (+/- 1130) = 63 MB/s ... test hex::tests::bench_from_hex ... bench: 884 ns/iter (+/- 220) = 341 MB/s test hex::tests::bench_to_hex ... bench: 2453 ns/iter (+/- 919) = 61 MB/s ``` After: ``` test base64::test::from_base64 ... bench: 1271 ns/iter (+/- 600) = 160 MB/s test base64::test::to_base64 ... bench: 759 ns/iter (+/- 286) = 198 MB/s ... test hex::tests::bench_from_hex ... bench: 875 ns/iter (+/- 377) = 345 MB/s test hex::tests::bench_to_hex ... bench: 593 ns/iter (+/- 240) = 254 MB/s ```
2013-08-06Some minor hex changesSteven Fackler-6/+8
2013-08-06Added hexadecimal encoding moduleSteven Fackler-0/+238
FromHex ignores whitespace and parses either upper or lower case hex digits. ToHex outputs lower case hex digits with no whitespace. Unlike ToBase64, ToHex doesn't allow you to configure the output format. I don't feel that it's super useful in this case.