localeCompare (v11)

Revision 11 of this benchmark created on


Setup

var s1 = "first";
    var s2 = "second";
    var comparestr = function(x, y) {var len=x.length|y.length, diff=0, i=0; while (((diff=(x.charCodeAt(i)||-1)-(y.charCodeAt(i)||-1))===0) && (i++<len)) {} return diff;}

Test runner

Ready to run.

Testing in
TestOps/sec
localeCompare
s1.localeCompare(s2)
ready
Operators
s1 < s2 ? -1 : s1 > s2 ? 1 : 0;
ready
charCodeAt
comparestr(s1, s2)
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.