Skip to content

Commit d1927d2

Browse files
committed
auto merge of #7137 : erickt/rust/from-elem-fixme, r=thestinger
This is to make sure we track optimizing `vec::from_elem`.
2 parents f74e193 + ac83f4b commit d1927d2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/libstd/vec.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,10 @@ pub fn from_fn<T>(n_elts: uint, op: old_iter::InitOp<T>) -> ~[T] {
146146
* to the value `t`.
147147
*/
148148
pub fn from_elem<T:Copy>(n_elts: uint, t: T) -> ~[T] {
149-
// hack: manually inline from_fn for 2x plus speedup (sadly very important, from_elem is a
150-
// bottleneck in borrowck!)
149+
// FIXME (#7136): manually inline from_fn for 2x plus speedup (sadly very
150+
// important, from_elem is a bottleneck in borrowck!). Unfortunately it
151+
// still is substantially slower than using the unsafe
152+
// vec::with_capacity/ptr::set_memory for primitive types.
151153
unsafe {
152154
let mut v = with_capacity(n_elts);
153155
do as_mut_buf(v) |p, _len| {

0 commit comments

Comments
 (0)