dasjflasdjkfjsaj

JavaScript performance comparison

Revision 18 of this test case created

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var controls = {
      airbrakes: {
        target: 0
      }
    };
    function log(e){return e.length + Math.random();}
};
</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
a
if (controls.airbrakes.target == 0) {
  controls.airbrakes.target = 1;
  log(controls.airbrakes);
} else {
  controls.airbrakes.target = 0;
  log(controls.airbrakes);
}
pending…
b
var airbrakes = controls.airbrakes;
airbrakes.target = +!airbrakes.target;
log(airbrakes);
pending…
c
var airbrakes = controls.airbrakes;
airbrakes.target = airbrakes.target ? 0 : 1;
log(airbrakes);
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