Major performance problem with std.array.front()

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Mar 7 11:03:04 PST 2014


On 3/7/14, 1:56 AM, Dmitry Olshansky wrote:
> 07-Mar-2014 07:22, bearophile пишет:
>> Walter Bright:
>>
>>> You use ranges a lot. Would it break any of your code?
>>
>> I need to try the changes to be sure. But the magnitude of this change
>> is so large that I guess some code will surely break.
>>
>> One advantage of your change is that this code will work:
>>
>> auto s = "hello".dup;
>> s.sort();
>
> Which it shouldn't unless there is an ascii type or some such.

Correct. This is a win, not a failure, of the current approach. To sort 
the bytes in "hello" write:

s.representation.sort();

which is indicative to the human and technically correct.


Andrei




More information about the Digitalmars-d mailing list