On 11/08/2013 07:50 PM, Igor Bukanov wrote:
On 8 November 2013 18:35, Patrick Walton <[email protected]> wrote:
But Daniel did some performance measurements and found that this had
suboptimal performance characteristics when compared to:

     struct ~str {
         char *ptr;
         int size;
         int cap;
     }

So we're changing to the latter.
Does this mean that when ~str is passed as a parameter the compiler
copies 3 words and that makes things faster?
According to https://github.com/mozilla/rust/issues/8981, yes and yes apparently. :)

You rarely pass around a ~[T] directly anyway, usually you work with slices to them, which right now consist of exactly two words. (Though that might change to three words too for unrelated consistency reasons)

Other speed improvements come from the fact that empty vectors no longer allocate, and that you no longer need to dereference a pointer into heap memory to get the size of an vector.


_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to