1 var Class = {
   2   create: function() {
   3     return function() { //vararg
   4         this.initialize.apply(this, arguments);
   5     }
   6   }
   7 };
   8 
   9 Color = Class.create();
  10 Color.prototype = {
  11     red: 0, green: 0, blue: 0,
  12     initialize: function(r,g,b) {
  13     this.red = r;
  14     this.green = g;
  15     this.blue = b;
  16     }
  17 }
  18 
  19 function bench(x) {
  20     var d = new Date;
  21     var colors = new Array(16);
  22     for (var i=0;i<1e8;i++) {
  23     colors[i&0xf] = (new Color(1,2,3));
  24     }
  25     print(new Date - d);
  26     return colors;
  27 }
  28 bench(17);
  29 
  30 print("Swapping out call");
  31 Function.prototype.call = function() {
  32     throw "This should not happen, apply should be called instead";
  33 };
  34 
  35 bench(17);
  36 
  37 print("All done!");