> Did COW improve performance?  What's a good way to do performance 
> testing of Rust code?

The reason I introduced COW when RC > 1 is that it allows persistent data 
structures to be mutated in place if there aren't extra references, just like 
non-persistent data structures.

Lots of languages with persistent data structures can't do that because they 
use garbage collection (and thus they can't tell whether there are other 
references due to lack of a reference count), but it seems an essential feature 
to have if one is using reference counting in a language like Rust that is 
supposed to be a systems language producing optimal code.

> Should I try to get your patches to Rc and Arc merged?  They look 
> generally useful, if folks think they fit the design of Rc.  You also 
> have a patch that adds Own<T> to std which is equivalent to ~T but has 
> methods that look like Rc's.  You use this, and putting most of your 
> treemap.rs inside macro definitions, to get a sort of 
> reference-type-polymorphism in your treemap.  Shall I continue with this 
> approach and try to get Own<T> merged too?  (Opinions from anybody are 
> welcome.)

I did it because I realized that having two different balanced tree 
implementations would have imposed a significant maintenance burden, and thus 
the macro and Own<T> approach would have allowed to avoid that by replacing the 
current treemap code completely with the new optionally-persistent version.

Also, having both Rc and Arc versions seems quite useful anyway, and currently 
I think macros are the best way to have both, until Rust starts supporting 
higher-kinded types (which would allow to pass Rc as a parameter), or at least 
recursive types (which would allow to express Rc<TreeNode<T, Rc<TreeNode, T, 
... and pass it as a parameter).

I don't have much more input on what the best names for the methods are, 
whether to have Own<T> instead of ~T and so on; I guess someone on the Rust 
core team will have to decide on that, and there's already some discussion on 
that on https://github.com/mozilla/rust/pull/9786

                                          
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to