On Thursday, 28 November 2013 at 09:02:12 UTC, Walter Bright wrote:
Sadly, std.array is determined to decode (i.e. convert to dchar[]) all your strings when they are used as ranges. This means that all algorithms on strings will be crippled as far as performance goes.

http://dlang.org/glossary.html#narrow strings

Very, very few operations on strings need decoding. The decoding should have gone into a separate layer.

Decoding by default means that algorithms can work reasonably with strings without being designed specifically for strings. The algorithms can then later be specialized for narrow strings, which I believe is happening for a few algorithms in std.algorithm like substring search.

Decoding is still available as a separate layer through std.utf, when more control over decoding is required.

Reply via email to