Array append performance

bearophile bearophileHUGS at lycos.com
Mon Aug 25 10:51:33 PDT 2008


Robert Jacques:
> This only works if strings are objects as there's an aliasing issue, so it  
> won't work for D arrays.

Well, D 2.x strings (and their slices) are immutable, so there is no problem. I agree that for mutable data structures (that can be modified from references) storing the hash value is dangerous. A compromise may be to have mutable arrays but immutable slices, that may solve the problem you show. Slices are small, so having them immutable is probably not too much bad.

Bye,
bearophile



More information about the Digitalmars-d mailing list