about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-06-14 16:58:55 -0700
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2013-06-14 16:58:55 -0700
commitac83f4b7325eea6ec82db73fb5c1ece7d8320908 (patch)
tree292602ebc6a20113f141ce0c1d7595f2359016ee /src/libstd
parenteadd83da8b9abc821b141195503836b2094a9ea3 (diff)
downloadrust-ac83f4b7325eea6ec82db73fb5c1ece7d8320908.tar.gz
rust-ac83f4b7325eea6ec82db73fb5c1ece7d8320908.zip
std: add a fixme to note performance issues in vec::from_elem.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/vec.rs6
1 files 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<T>(n_elts: uint, op: old_iter::InitOp<T>) -> ~[T] {
  * to the value `t`.
  */
 pub fn from_elem<T:Copy>(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| {