[phobos] phobos commit, revision 2305

Andrei Alexandrescu andrei at erdani.com
Tue Jan 11 01:38:51 PST 2011


Okay, though I wonder whether that's even measurable. The bulk is the 
string comparison in most cases.

I think we could and probably should abstract cmp3way() in std.algorithm 
as a template that is specialized for various types to work as 
efficiently as possible.


Andrei

On 1/11/11 1:25 AM, Walter Bright wrote:
> I think it would be more efficient to write it as:
>
> static if (s1.length.sizeof == int.sizeof)
> return s1.length - s2.length;
> else
> return s1.length > s2.length ? 1 : s1.length < s2.length ? -1 : 0;
>
> dsource.org wrote:
>> phobos commit, revision 2305
>>
>>
>> user: andrei
>>
>> msg:
>> Reverted cmp and icmp to return int, take 2
>>
>> http://www.dsource.org/projects/phobos/changeset/2305
>>
>> paths changed:
>> U trunk/phobos/std/string.d
>>
>>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos


More information about the phobos mailing list