- 07 8月, 2013 17 次提交
-
-
由 Erick Tryzelaar 提交于
-
由 Erick Tryzelaar 提交于
-
由 Erick Tryzelaar 提交于
-
由 bors 提交于
Implement saturating math in `std::num::Saturating` and use it for `Iterator` impls
-
由 bors 提交于
Some general clean-up relating to deriving: - `TotalOrd` was too eager, and evaluated the `.cmp` call for every field, even if it could short-circuit earlier. - the pointer types didn't have impls for `TotalOrd` or `TotalEq`. - the Makefiles didn't reach deep enough into libsyntax for dependencies. (Split out from https://github.com/mozilla/rust/pull/8258.)
-
由 Huon Wilson 提交于
-
由 bors 提交于
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.
-
由 bors 提交于
Original pull request: Add str.to_ascii_lower() and str.to_ascii_upper() methods in std::str.
-
由 Simon Sapin 提交于
-
由 bors 提交于
Now that LLVM has been upgraded, I think that we can try again to re-enable the rusti tests.
-
由 Steven Fackler 提交于
-
由 bors 提交于
This lazily initializes the taskgroup structs for ```spawn_unlinked``` tasks. If such a task never spawns another task linked to it (or a descendant of it), its taskgroup is simply never initialized at all. Also if an unlinked task spawns another unlinked task, neither of them will need to initialize their taskgroups. This works for the main task too. I benchmarked this with the following test case and observed a ~~21% speedup (average over 4 runs: 7.85 sec -> 6.20 sec, 2.5 GHz)~~ 11% speedup, see comment below. ``` use std::task; use std::cell::Cell; use std::rt::comm; static NUM: uint = 1024*256; fn run(f: ~fn()) { let mut t = task::task(); t.unlinked(); t.spawn(f); } fn main() { do NUM.times { let (p,c) = comm::oneshot(); let c = Cell::new(c); do run { c.take().send(()); } p.recv(); } } ```
-
由 Steven Fackler 提交于
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.
-
由 Steven Fackler 提交于
String NULL terminators are going away soon, so we may as well get rid of this now so it doesn't rot.
-
由 Steven Fackler 提交于
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 ```
-
由 Steven Fackler 提交于
-
由 Steven Fackler 提交于
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.
-
- 06 8月, 2013 23 次提交
-
-
由 bors 提交于
-
由 bors 提交于
Closes #4430
-
由 bors 提交于
`fn slice_bytes` is marked unsafe since it allows violating the valid string encoding property; but the function did also allow extending the lifetime of the slice by mistake, since it's returning `&str`. Use the annotation `slice_bytes<'a>(&'a str, ...) -> &'a str` so that all uses of `slice_bytes` are region checked correctly.
-
由 bors 提交于
Fix #8004
-
由 Kevin Ballard 提交于
Replace hand-rolled saturation math with calls to Saturating. Fix one impl that didn't use saturating math.
-
由 Kevin Ballard 提交于
Saturating is an implementation of saturating math operations (at the moment just add and sub) for integral types.
-
由 Sangeun Kim 提交于
-
由 bors 提交于
Fix #8228 by replacing .iter() and .iter_err() in Result by external iterators. Implement random access for `iterator::Invert` and `vec::ChunkIter` (and bidirectionality). Implement Repeat iterator.
-
由 bors 提交于
-
由 blake2-ppc 提交于
ChunkIter .idx() didn't handle overflow correctly, even though it tried.
-
由 blake2-ppc 提交于
-
由 blake2-ppc 提交于
-
由 blake2-ppc 提交于
-
由 blake2-ppc 提交于
With Option as the simplest container, `consume` is the way to turn it into a by-value iterator.
-
由 blake2-ppc 提交于
Use the Repeat iterator to carry the "explicit closure capture" that was previously done with the custom EnvFilterIterator.
-
由 blake2-ppc 提交于
-
由 blake2-ppc 提交于
Implement clone, bidirectionality and random access for this iterator
-
由 blake2-ppc 提交于
-
由 blake2-ppc 提交于
-
由 blake2-ppc 提交于
convert iter() and iter_err() for Result. Use OptionIterator.
-
由 blake2-ppc 提交于
Let Option be a base for a widely useful one- or zero- item iterator. Refactor OptionIterator to support any generic element type, so the same iterator impl can be used for both &T, &mut T and T iterators.
-
由 Alex Crichton 提交于
-
由 bors 提交于
This is an alternative version to https://github.com/mozilla/rust/pull/8268, where instead of transitioning to `get()` completely, I transitioned to `unwrap()` completely. My reasoning for also opening this PR is that having two different functions with identical behavior on a common datatype is bad for consistency and confusing for users, and should be solved as soon as possible. The fact that apparently half the code uses `get()`, and the other half `unwrap()` only makes it worse. If the final naming decision ends up different, there needs to be a big renaming anyway, but until then it should at least be consistent. --- - Made naming schemes consistent between Option, Result and Either - Lifted the quality of the either and result module to that of option - Changed Options Add implementation to work like the maybe Monad (return None if any of the inputs is None) See https://github.com/mozilla/rust/issues/6002, especially my last comment. - Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead See also https://github.com/mozilla/rust/issues/7887. Todo: Adding testcases for all function in the three modules. Even without the few functions I added, the coverage wasn't complete to begin with. But I'd rather do that as a follow up PR, I've touched to much code here already, need to go through them again later.
-