diff options
| author | Stepan Koltsov <stepan.koltsov@gmail.com> | 2015-11-08 17:17:02 +0300 |
|---|---|---|
| committer | Stepan Koltsov <stepan.koltsov@gmail.com> | 2015-11-08 17:17:02 +0300 |
| commit | e3433e3b519dfaddedd5f18a514604a779799da3 (patch) | |
| tree | 58cc02a7083871913ffd1b496f987fdc32891947 | |
| parent | 01fc81f249cf8d81bbb5f1d6675bfb14fe20afdd (diff) | |
| download | rust-e3433e3b519dfaddedd5f18a514604a779799da3.tar.gz rust-e3433e3b519dfaddedd5f18a514604a779799da3.zip | |
Fix outdated comment in Vec::from_iter
Since commit 46068c9da, call to `reserve()` on empty vec allocates exactly requested capacity, so unroll of first iteration may help only with branch prediction.
| -rw-r--r-- | src/libcollections/vec.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 716a07be2b4..c4e4059429f 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1220,8 +1220,7 @@ impl<T> FromIterator<T> for Vec<T> { // expanded on this iteration in every case when the iterable is not // empty, but the loop in extend_desugared() is not going to see the // vector being full in the few subsequent loop iterations. - // So we get better branch prediction and the possibility to - // construct the vector with initial estimated capacity. + // So we get better branch prediction. let mut iterator = iterable.into_iter(); let mut vector = match iterator.next() { None => return Vec::new(), |
