base construction

JavaScript performance comparison

Test case created by Juan

Preparation code

<script type="text/javascript" src="http://yui.yahooapis.com/combo?3.8.1/build/yui-base/yui-base-min.js&3.8.1/build/oop/oop-min.js&3.8.1/build/attribute-core/attribute-core-min.js&3.8.1/build/event-custom-base/event-custom-base-min.js&3.8.1/build/event-custom-complex/event-custom-complex-min.js&3.8.1/build/attribute-observable/attribute-observable-min.js&3.8.1/build/attribute-extras/attribute-extras-min.js&3.8.1/build/attribute-base/attribute-base-min.js&3.8.1/build/base-core/base-core-min.js&3.8.1/build/base-observable/base-observable-min.js&3.8.1/build/base-base/base-base-min.js&3.8.1/build/pluginhost-base/pluginhost-base-min.js&3.8.1/build/pluginhost-config/pluginhost-config-min.js&3.8.1/build/base-pluginhost/base-pluginhost-min.js&3.8.1/build/base-build/base-build-min.js"></script>
<script type="text/javascript">
var Y = YUI().use('base');

function FooBase() {
  FooBase.superclass.constructor.apply(this, arguments);
}
Y.extend(FooBase, Y.Base, null, {
  ATTRS: {
    bar: {
      value: 'bar'
    }
  }
});

function FooBaseCore() {
  FooBaseCore.superclass.constructor.apply(this, arguments);
}
Y.extend(FooBaseCore, Y.BaseCore, null, {
  ATTRS: {
    bar: {
      value: 'bar'
    }
  }
});

function FooAttrCore() {
  FooAttrCore.superclass.constructor.apply(this, arguments);
}
Y.extend(FooAttrCore, Y.AttributeCore, null, {
  ATTRS: {
    bar: {
      value: 'bar'
    }
  }
});
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Base
var foo = new FooBase();
pending…
BaseCore
var foo = new FooBaseCore();
pending…
AttributeCore
var foo = new FooAttrCore();
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