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
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to