09-Mar-2014 21:45, Andrei Alexandrescu пишет:
On 3/9/14, 10:21 AM, Vladimir Panteleev wrote:
On Sunday, 9 March 2014 at 17:18:47 UTC, Andrei Alexandrescu wrote:
On 3/9/14, 5:28 AM, Joseph Rushton Wakeling wrote:
So IIUC iterating over s.byChar would not encounter the
decoding-related
speed hits that Walter is concerned about?
That is correct.
Unless I'm missing something, all algorithms that can work faster on
arrays will need to be adapted to also recognize byChar-wrapped arrays,
unwrap them, perform the fast array operation, and wrap them back in a
byChar.
Good point. Off the top of my head I can't remember any algorithm that
relies on array representation to do better on arrays than on
random-access ranges offering all of arrays' primitives. But I'm sure
there are a few.
copy to begin with. And it's about 80x faster with plain arrays.
--
Dmitry Olshansky