nicer option valuating?

JavaScript performance comparison

Test case created by Florian Maertl

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script>
Benchmark.prototype.setup = function() {
    var flow;
    var aniConf1 = {
      flow: "left"
    };
    var aniConf2 = {
      flow: "right"
    };
    var aniConf3 = null;
    var aniConf4 = {
      flowFalse: "top"
    };
   
    function method1(conf) {
      flow = (jQuery.extend({
        flow: "left"
      }, conf)).flow;
    }
   
    function method2(conf) {
      if (conf != null && conf.flow != null) {
        flow = conf.flow;
      }
    }
};
</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
with jQuery.extend
method1(aniConf1);
method1(aniConf2);
method1(aniConf3);
method1(aniConf4);
pending…
basic if
method2(aniConf1);
method2(aniConf2);
method2(aniConf3);
method2(aniConf4);
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