From ac83f4b7325eea6ec82db73fb5c1ece7d8320908 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Fri, 14 Jun 2013 16:58:55 -0700 Subject: [PATCH] std: add a fixme to note performance issues in vec::from_elem. --- src/libstd/vec.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 19233c53348..f6f5b98df67 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -155,8 +155,10 @@ pub fn from_fn(n_elts: uint, op: old_iter::InitOp) -> ~[T] { * to the value `t`. */ pub fn from_elem(n_elts: uint, t: T) -> ~[T] { - // hack: manually inline from_fn for 2x plus speedup (sadly very important, from_elem is a - // bottleneck in borrowck!) + // FIXME (#7136): manually inline from_fn for 2x plus speedup (sadly very + // important, from_elem is a bottleneck in borrowck!). Unfortunately it + // still is substantially slower than using the unsafe + // vec::with_capacity/ptr::set_memory for primitive types. unsafe { let mut v = with_capacity(n_elts); do as_mut_buf(v) |p, _len| {