Array append performance
Denis Koroskin
2korden at gmail.com
Mon Aug 25 11:03:17 PDT 2008
On Mon, 25 Aug 2008 21:51:33 +0400, bearophile <bearophileHUGS at lycos.com>
wrote:
> 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
I don't follow you. Immutability of the slice implies that the whole array
is immutable, too.
Besides, how often do you take a hash of an array other than string?
More information about the Digitalmars-d
mailing list