ffs constructors

JavaScript performance comparison

Test case created by Peter Hamberg

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    function make(parm) {
        return {
          parm: function() {
            return parm + 2
          }
        };
        };
   
    function Make(p) {
        this.parm = function() {
          return p + 2
        };
        }
};
</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
crockford
var a = make(4);
a.parm();
pending…
this
var b = new Make(4);
b.parm();
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