On 06/13/2012 04:15 PM, Niko Matsakis wrote:
Hello,I wanted to check something. We are working on the Great Change to a more flexible vector system and I want to outline the design that's in my head. This has some implications for How Efficient Rust Code Is Written, so I wanted to make sure we were all on the same page. *Implications for writing efficient Rust* I figured I'd just start with the implications for writing Rust. Currently, to build up a vector, we rely upon an idiom like: let mut v = []; for some loop { v += [elt]; } Now, often, such loops can (and should) be written using a higher-order function (e.g., map, filter). But sometimes not. In such cases, under the new regime, the recommended idiom would be: let dv = dvec(); for some loop { v.push(elt); } let v = dvec::unwrap(dv); // if necessary, convert to a vector
This method of creating vectors originally had worse performance than the other. Is the performance problem resolved or resolvable or is vector creation just going to be expensive?
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
