localeCompare-test

JavaScript performance comparison

Test case created by Per

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var stringA = "hello world";
    var stringB = "hello ipsum";
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
localeCompare
stringA.localeCompare(stringB)
pending…
charAt compare
var len = Math.min(stringA.length, stringB.length);
var diff = 0;
for (var i = 0; i < len; i++) {
  diff = stringA.charCodeAt(i) - stringB.charCodeAt(i);
  if (diff != 0) break;
}
diff = stringA.length - stringB.length;
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment