Testing for -1

JavaScript performance comparison

Test case created

Info

Takes from the SO question: http://stackoverflow.com/questions/12266301/is-index-faster-than-index-1

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var valPos = 1;
    var valNeg = -1;
};
</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
Logical Not
(!~valPos);
(!~valNeg);
pending…
Comparison
(valPos === -1);
(valNeg === -1);
 
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