[rust-dev] Performance optimization

Patrick Walton pwalton at mozilla.com
Sat Apr 7 09:45:14 PDT 2012


On 04/07/2012 04:08 AM, Grahame Bowland wrote:
> For the case of "one big data structure multiple workers want to read
> from", couldn't we write a module to do this within the language as it
> stands? The module could take a unique reference (which can't contain
> anything mutable), then issue (via unsafe code) immutable pointers to
> the structure on request.
>
> Obviously it's a broken thing to do (and afaik the language doesn't
> guarantee that the address won't change unexpectedly, although I don't
> think it will in the current implementation), but it might be an
> interesting experiment.

Relevant here are Niko's thoughts on parallel blocks:

http://smallcultfollowing.com/babysteps/blog/2011/12/09/pure-blocks/

I'm very much in favor of experimentation in the unsafe module to find 
what works in advance of baking stuff into the language. I feel that's 
the right way to do programming language work -- "pave the cow paths", 
as Dave Herman likes to say :)

Patrick


More information about the Rust-dev mailing list