functional

grauzone none at example.net
Wed Mar 10 17:33:33 PST 2010


Walter Bright wrote:
> grauzone wrote:
>> Data this small you would simply copy. Because it's so small, copying 
>> won't have negative performance impact. The OS approach can be used 
>> for large data (at least in the order of hundreds of KB) and immutable 
>> parts of the data segment.
> 
> You'd also have to transitively copy everything referenced.

If that becomes a problem depends entirely from how the message passing 
API (or whatever) is used*. And the only common case where this works 
really elegantly are strings. (But most strings are short and could be 
copied effortlessly.)

On the contrary, frequently allocating immutable data on a shared heap 
just to transfer it to another thread isn't going to be very efficient 
either. You won't be able to go with a shared GC forever, because it SO 
doesn't scale with multiprocessing.

* This stuff probably depends a lot on actual use cases. Did you or 
Andrei envision anything in this direction? I figure you thought about 
this much more than e.g. me, but I never hear any concrete things.



More information about the Digitalmars-d mailing list