sjperftest

JavaScript performance comparison

Test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var arr = [
          ['lehlowww', 'hello'],
          ['dlrwxdonexfe', 'oneworld'],
          ['oenhodwrol', 'oneworld'],
          ['rkqodlw', 'world'],
          ['olaelh', 'hello'],
          ['helio', 'hell'],
          ['abcewnorde', 'wonder'],
          ['wioskrngatwo', 'workingtwo'],
          ['locaacedo', 'locatedhere'],
          ['edfbenowaginning', 'beginningnow']];
       
        var answers = [true,false,true,true,true,false,true,true,false,true];
};
</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
test1
for (var i = 0; i < arr.length; i++) {
  if (answers[i] !== StringScramble(arr[i][0], arr[i][1])) {
    throw new Exception('wrong answer');
  }
}

function StringScramble(str1, str2) {
                var len = str2.length,
                        i = 0,
                        pos;
                str1 = str1.split('');
                for (; i < len; i += 1) {
                        pos = str1.indexOf(str2[i]);
                        if (pos === -1) return false;

                        str1[i] = '.';

                }

                return true;
        }
pending…
test2
return true;
pending…

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

Compare results of other browsers

0 comments

Add a comment