Instantiation speed

JavaScript performance comparison

Test case created by picanteverde

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var fnAction = function(){
  	var i;
  	for(i = 0; i < 10; i += 1){
  	}
  };
  
  
  var PseudoClass = function(){
  
  };
  
  PseudoClass.prototype.action1 = fnAction;
  
  var PseudoSubClass = function(){
  
  };
  
  PseudoSubClass.prototype = new PseudoClass();
  
  PseudoSubClass.prototype.action2 = fnAction;
  
  var makeParasitic = function (){
  	return {
  		action1: fnAction
  	};
  };
  
  var makeSubParasitic = function(){
  	var o = makeParasitic();
  	o.action2 = fnAction;
  	return o;
  };

};
</script>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
PseudoClass instance
var o = new PseudoSubClass();
pending…
Parasitic instance
var o = makeSubParasitic();
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.

0 Comments