Lively Kernel canvas DraftBenchmarkContextJS40true uploadresultsfalsenullfalsetruenull oldresultsfalsenullfalsetruenull Config.ignoredepricatedProceed=true130533 extendString=function(s,length){while(s.length<length){s=s+"";}returns}extendString("123",20)1353786 ContextJSBenchmarkDate:ThuOct07201016:17:56GMT+0200(CEST)Browser:Mozilla/5.0(Macintosh;U;IntelMacOSX10_6_4;en-us)AppleWebKit/533.18.1(KHTML,likeGecko)Version/5.0.2Safari/533.18.5Revision:30490nameopstimeops/timePLAINo.foo1()12800101280Instancespecifico.foo12560028914ManualWrapo.foo1640010640..withapplyarguments640010640..withapply$A(arguments)320011291Wrapo.foo1()8001173Layeredo.foo2()8001747Layeractiveo.foo2()4001724activeLayersPLAIN16001794MyLayerableObjectPLAIN8001553MyLayerableObjectsetWithLayers4001040..(inowner)8001844..(owner.owner)8001942..(inowner.owner.owner)4001040..(inowner.owner.ownerFAIL)8001267AltLayerableObj.PLAIN8001267AltLayerableObj.setWithLayers8001942..(inowner)8001844..(owner.owner)8001942..(inowner.owner.owner)8001942..(inowner.owner.ownerFAIL)8001267121062truetruefalse1625121067truetrue 121070 false12106910.11 true false121066 true 121073 nullfalse121074truenull Workspace121076falsenulltruefalse X121080falsenulltrue false121079 false M121084falsenulltrue false121083 false 121088falsenulltrue false121087 false121072nullfalse121071falsenullnullnullnullfalse Wikicontroltruetrue CopBenchmark.MAXSIZE=1000000000CopBenchmark.TARGETTIME=10require('cop.Layers').toRun(function(){LayerableObject.subclass("FastLayerableObject",{activeLayers:function(){varresult={withLayers:[],withoutLayers:[]};result=this.dynamicLayers(result);result=this.structuralLayers(result)result=this.globalLayers(result)returnresult.withLayers},collectWithLayersIn:function(layers,result){for(vari=0;i<layers.length;i++){varea=layers[i]if((result.withLayers.indexOf(ea)===-1)&&(result.withoutLayers.indexOf(ea)===-1)){result.withLayers.unshift(ea)}};},collectWithoutLayersIn:function(layers,result){for(vari=0;i<withLayers.length;i++){varea=withLayers[i]if((result.withoutLayers.indexOf(ea)===-1)){result.withoutLayers.push(ea)}};},dynamicLayers:function(result){//optimizedversion,thatdoesnotuseclosuresandrecursionvarallLayers=result.withLayers;varallWithoutLayers=result.withoutLayers;varstack=cop.LayerStack;//topdown,ignorebottomelementfor(varj=stack.length-1;j>0;j--){varcurrent=stack[j];if(current.withLayers){for(vari=0;i<current.withLayers.length;i++){varea=current.withLayers[i];if((allLayers.indexOf(ea)===-1)&&(allWithoutLayers.indexOf(ea)===-1)){allLayers.push(ea)}}};if(current.withouLayers){for(vari=0;i<current.withoutLayers.length;i++){varea=current.withoutLayers[i];varea=allWithoutLayers[i]allWithoutLayers.push(ea)};}}returnresult},structuralLayers:function(result){varallLayers=result.withLayers;varallWithoutLayers=result.withoutLayers;varobj=this;//goownerchainbackwardandgatheralllayeractivationsanddeactivationswhile(obj){//don'tuseaccessormethodsbecauseofspeed...(notmeasuredyet)if(obj.withLayers){this.collectWithLayersIn(obj.withLayers,result);};if(obj.withoutLayers){this.collectWithoutLayersIn(obj.withoutLayers,result);};//recurse,stopifownerisundefinedobj=obj.owner}returnresult;},globalLayers:function(result){this.collectWithLayersIn(cop.GlobalLayers,result);returnresult},});})Object.subclass('MyObject',{foo1:function(a){returna*a},foo2:function(a){returna*a},})createLayer("MyLayer");layerClass(MyLayer,MyObject,{foo2:function(a){returncop.proceed(a)*a}})Object.subclass('MyStructuralObject',{foo:function(a){returna*a},})layerClass(MyLayer,MyStructuralObject,{foo:function(a){returncop.proceed(a)*a}})LayerableObject.subclass("MyLayerableObject",{foo:function(a){returna*a}})layerClass(MyLayer,MyLayerableObject,{foo:function(a){returncop.proceed(a)*a}})LayerableObject.subclass("AltLayerableObject",{foo:function(a){returna*a},})layerClass(MyLayer,AltLayerableObject,{foo:function(a){returncop.proceed(a)*a}})//BenchmarksCopBenchmark.benchmarksToRun=[{name:"PLAINo.foo1()",run:function(name){varo=newMyObject();console.profile()CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o.foo1(i)}})console.profileEnd()}},{name:"Instancespecifico.foo1",run:function(name){varo=newMyObject();o.foo1=function(a){returna*a*a}CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o.foo1(i)}})}},{name:"ManualWrapo.foo1",run:function(name){varo=newMyObject();varoldFunc=o.foo1;o.foo1=function(v){oldFunc(v)*v}CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o.foo1(i)}})}},{name:"..withapplyarguments",run:function(name){varo=newMyObject();varoldFunc=o.foo1;o.foo1=function(v){oldFunc.apply(o,arguments)*v}CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o.foo1(i)}})}},{name:"..withapply$A(arguments)",run:function(name){varo=newMyObject();varoldFunc=o.foo1;o.foo1=function(v){oldFunc.apply(o,$A(arguments))*v}CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o.foo1(i)}})}},{name:"Wrapo.foo1()",run:function(name){varo=newMyObject();o.foo1=o.foo1.wrap(function(p,v){p(v)+v})CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o.foo1(i)}})}},{name:"Layeredo.foo2()",run:function(name){varo=newMyObject();CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o.foo2(i)}})}},{name:"Layeractiveo.foo2()",run:function(name){varo=newMyObject();withLayers([MyLayer],function(){CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o.foo2(i)}})})}},{name:"activeLayersPLAIN",run:function(name){varo=newMyStructuralObject();o.activeLayers=function(){return[]};CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o.foo(i)}})}},{name:"MyLayerableObjectPLAIN",run:function(name){varo=newMyLayerableObject();CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o.foo(i)}})}},{name:"MyLayerableObjectsetWithLayers",run:function(name){varo=newMyLayerableObject();o.setWithLayers([MyLayer])CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o.foo(i)}})}},{name:"..(inowner)",run:function(name){varo=newMyLayerableObject();o.setWithLayers([MyLayer])varo2=newMyLayerableObject();o2.lookupLayersIn=["owner"]o2.owner=oCopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o2.foo(i)}})}},{name:"..(owner.owner)",run:function(name){varo=newMyLayerableObject();o.setWithLayers([MyLayer])varo2=newMyLayerableObject();o2.lookupLayersIn=["owner"]o2.owner=o;varo3=newMyLayerableObject();o3.lookupLayersIn=["owner"];o3.owner=o2;CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o3.foo(i)}})}},{name:"..(inowner.owner.owner)",run:function(name){varo=newMyLayerableObject();o.setWithLayers([MyLayer])varo2=newMyLayerableObject();o2.lookupLayersIn=["owner"]o2.owner=o;varo3=newMyLayerableObject();o3.lookupLayersIn=["owner"];o3.owner=o2;varo4=newMyLayerableObject();o4.lookupLayersIn=["owner"];o4.owner=o3;CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o4.foo(i)}})}},{name:"..(inowner.owner.ownerFAIL)",run:function(name){varo=newMyLayerableObject();varo2=newMyLayerableObject();o2.lookupLayersIn=["owner"]o2.owner=o;varo3=newMyLayerableObject();o3.lookupLayersIn=["owner"];o3.owner=o2;varo4=newMyLayerableObject();o4.lookupLayersIn=["owner"];o4.owner=o3;CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o4.foo(i)}})}},{name:"AltLayerableObj.PLAIN",run:function(name){varo=newAltLayerableObject();CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o.foo(i)}})}},{name:"AltLayerableObj.setWithLayers",run:function(name){varo=newAltLayerableObject();o.setWithLayers([MyLayer])CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o.foo(i)}})}},{name:"..(inowner)",run:function(name){varo=newAltLayerableObject();o.setWithLayers([MyLayer])varo2=newAltLayerableObject();o2.lookupLayersIn=["owner"]o2.owner=oCopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o2.foo(i)}})}},{name:"..(owner.owner)",run:function(name){varo=newAltLayerableObject();o.setWithLayers([MyLayer])varo2=newAltLayerableObject();o2.lookupLayersIn=["owner"]o2.owner=o;varo3=newAltLayerableObject();o3.lookupLayersIn=["owner"];o3.owner=o2;CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o3.foo(i)}})}},{name:"..(inowner.owner.owner)",run:function(name){varo=newAltLayerableObject();o.setWithLayers([MyLayer])varo2=newAltLayerableObject();o2.lookupLayersIn=["owner"]o2.owner=o;varo3=newAltLayerableObject();o3.lookupLayersIn=["owner"];o3.owner=o2;varo4=newAltLayerableObject();o4.lookupLayersIn=["owner"];o4.owner=o3;CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o4.foo(i)}})}},{name:"..(inowner.owner.ownerFAIL)",run:function(name){varo=newAltLayerableObject();varo2=newAltLayerableObject();o2.lookupLayersIn=["owner"]o2.owner=o;varo3=newAltLayerableObject();o3.lookupLayersIn=["owner"];o3.owner=o2;varo4=newAltLayerableObject();o4.lookupLayersIn=["owner"];o4.owner=o3;CopBenchmark.benchmarkBlock(name,1,function(size,obj){for(vari=0;i<size;i++){o4.foo(i)}})}},]CopBenchmark.runDelayed=functionrunDelayed(){varbenchmark=CopBenchmark.benchmarksToRun.shift();if(!benchmark){CopBenchmark.printResults();return};//console.log("run"+benchmark.name)//console.profile(benchmark.name);benchmark.run(benchmark.name);//console.profileEnd(benchmark.name);Global.setTimeout(runDelayed,10);};CopBenchmark.result="ContextJSBenchmark\n"+"Date:\t"+newDate()+"\n"+"Browser:\t"+navigator.userAgent+"\n"+"Revision:\t"+WikiNavigator.current.model.getOriginalRevision()+"\n"+"name\topstimeops/time\n";CopBenchmark.runDelayed(); 0; j--) { \n\t\t\tvar current = stack[j];\n\t\t\tif (current.withLayers) {\n\t\t\t\tfor(var i=0; i < current.withLayers.length; i++) {\n\t\t\t\t\tvar ea = current.withLayers[i];\n\t\t\t\t\tif ((allLayers.indexOf(ea) === -1) && (allWithoutLayers.indexOf(ea) === -1)) {\n\t\t\t\t\t\tallLayers.push(ea)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (current.withouLayers) {\n\t\t\t\tfor(var i=0; i < current.withoutLayers.length; i++) {\n\t\t\t\t\tvar ea = current.withoutLayers[i];\n\t\t\t\t\tvar ea = allWithoutLayers[i]\n\t\t\t\t\tallWithoutLayers.push(ea)\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\treturn result\n\t},\n\n\tstructuralLayers: function(result) {\n\t\tvar allLayers = result.withLayers;\n\t\tvar allWithoutLayers = result.withoutLayers;\n\t\tvar obj = this;\n\n\t\t// go ownerchain backward and gather all layer activations and deactivations\n\t\twhile(obj) {\t\t\n\t\t\t// don't use accessor methods because of speed... (not measured yet)\n\t\t\tif (obj.withLayers) {\n\t\t\t\tthis.collectWithLayersIn(obj.withLayers, result);\n\t\t\t};\n\t\t\tif (obj.withoutLayers) {\n\t\t\t\tthis.collectWithoutLayersIn(obj.withoutLayers, result);\n\t\t\t};\n\t\t\t// recurse, stop if owner is undefined\n\t\t\tobj = obj.owner\n\t\t}\n\t\treturn result;\n\t},\n\n\tglobalLayers: function(result) {\n\t\tthis.collectWithLayersIn(cop.GlobalLayers, result);\n\t\treturn result\n\t},\t\n\n});\n\n})\n\n\nObject.subclass('MyObject', {\n\n\tfoo1: function(a) {\n\t\treturn a * a\n\t},\n\n\tfoo2: function(a) {\n\t\treturn a * a\n\t},\n})\n\ncreateLayer(\"MyLayer\");\nlayerClass(MyLayer, MyObject, {\n\tfoo2: function(a) {\n\t\treturn cop.proceed(a) * a\n\t}\n})\n\nObject.subclass('MyStructuralObject', {\n\tfoo: function(a) {\n\t\treturn a * a\n\t},\n})\n\nlayerClass(MyLayer, MyStructuralObject, {\n\tfoo: function(a) {\n\t\treturn cop.proceed(a) * a\n\t}\n})\n\nLayerableObject.subclass(\"MyLayerableObject\", {\n\tfoo: function( a) {\n\t\treturn a * a\n\t}\n})\n\nlayerClass(MyLayer, MyLayerableObject, {\n\tfoo: function(a) {\n\t\treturn cop.proceed(a) * a\n\t}\n})\n\n\nLayerableObject.subclass(\"AltLayerableObject\", {\n\tfoo: function( a) {\n\t\treturn a * a\n\t},\n\n})\n\nlayerClass(MyLayer, AltLayerableObject, {\n\tfoo: function(a) {\n\t\treturn cop.proceed(a) * a\n\t}\n})\n\n\n\n// Benchmarks\n\nCopBenchmark.benchmarksToRun = [\n\t{name: \"PLAIN o.foo1() \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyObject();\n\t\t\tconsole.profile() \n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo1(i)\n\t\t\t\t}\n\t\t\t})\n\t\t\tconsole.profileEnd()\n\t\t}\n\t},\n\n\n\t{name: \"Instance specific o.foo1 \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyObject();\n\t\t\to.foo1 = function(a) {return a * a * a}\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo1(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \"Manual Wrap o.foo1 \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyObject();\n\t\t\tvar oldFunc = o.foo1;\n\t\t\to.foo1 = function(v) {oldFunc(v) * v}\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo1(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\n\t{name: \".. with apply arguments\", \n\t\trun: function(name) {\n\t\t\tvar o = new MyObject();\n\t\t\tvar oldFunc = o.foo1;\n\t\t\to.foo1 = function(v) {oldFunc.apply(o, arguments) * v}\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo1(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \".. with apply $A(arguments)\", \n\t\trun: function(name) {\n\t\t\tvar o = new MyObject();\n\t\t\tvar oldFunc = o.foo1;\n\t\t\to.foo1 = function(v) {oldFunc.apply(o, $A(arguments)) * v}\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo1(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \"Wrap o.foo1() \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyObject();\n\t\t\to.foo1 = o.foo1.wrap(function(p, v) { p(v) + v })\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo1(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \"Layered o.foo2() \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyObject();\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo2(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\t{name: \"Layer active o.foo2() \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyObject();\n\t\t\twithLayers([MyLayer], function() {\n\t\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\t\to.foo2(i)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\t},\n\t{name: \"activeLayers PLAIN \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyStructuralObject();\n\t\t\to.activeLayers = function() {return []};\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \"MyLayerableObject PLAIN\", \n\t\trun: function(name) {\n\t\t\tvar o = new MyLayerableObject();\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \"MyLayerableObject setWithLayers\", \n\t\trun: function(name) {\n\t\t\tvar o = new MyLayerableObject();\n\t\t\to.setWithLayers([MyLayer])\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \".. (in owner) \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyLayerableObject();\n\t\t\to.setWithLayers([MyLayer])\n\t\t\tvar o2 = new MyLayerableObject();\n\t\t\to2.lookupLayersIn = [\"owner\"]\n\t\t\to2.owner = o\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to2.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\n\t{name: \".. (owner.owner) \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyLayerableObject();\n\t\t\to.setWithLayers([MyLayer])\n\t\t\tvar o2 = new MyLayerableObject();\n\t\t\to2.lookupLayersIn = [\"owner\"]\n\t\t\to2.owner = o;\n\n\t\t\tvar o3 = new MyLayerableObject();\n\t\t\to3.lookupLayersIn = [\"owner\"];\n\t\t\to3.owner = o2;\n\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to3.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\n\t{name: \".. (in owner.owner.owner) \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyLayerableObject();\n\t\t\to.setWithLayers([MyLayer])\n\t\t\tvar o2 = new MyLayerableObject();\n\t\t\to2.lookupLayersIn = [\"owner\"]\n\t\t\to2.owner = o;\n\n\t\t\tvar o3 = new MyLayerableObject();\n\t\t\to3.lookupLayersIn = [\"owner\"];\n\t\t\to3.owner = o2;\n\n\t\t\tvar o4 = new MyLayerableObject();\n\t\t\to4.lookupLayersIn = [\"owner\"];\n\t\t\to4.owner = o3;\n\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to4.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\n\t{name: \".. (in owner.owner.owner FAIL)\", \n\t\trun: function(name) {\n\t\t\tvar o = new MyLayerableObject();\n\t\t\tvar o2 = new MyLayerableObject();\n\t\t\to2.lookupLayersIn = [\"owner\"]\n\t\t\to2.owner = o;\n\n\t\t\tvar o3 = new MyLayerableObject();\n\t\t\to3.lookupLayersIn = [\"owner\"];\n\t\t\to3.owner = o2;\n\n\t\t\tvar o4 = new MyLayerableObject();\n\t\t\to4.lookupLayersIn = [\"owner\"];\n\t\t\to4.owner = o3;\n\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to4.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \"AltLayerableObj. PLAIN\", \n\t\trun: function(name) {\n\t\t\tvar o = new AltLayerableObject();\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \"AltLayerableObj. setWithLayers\", \n\t\trun: function(name) {\n\t\t\tvar o = new AltLayerableObject();\n\t\t\to.setWithLayers([MyLayer])\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \".. (in owner) \", \n\t\trun: function(name) {\n\t\t\tvar o = new AltLayerableObject();\n\t\t\to.setWithLayers([MyLayer])\n\t\t\tvar o2 = new AltLayerableObject();\n\t\t\to2.lookupLayersIn = [\"owner\"]\n\t\t\to2.owner = o\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to2.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\n\t{name: \".. (owner.owner) \", \n\t\trun: function(name) {\n\t\t\tvar o = new AltLayerableObject();\n\t\t\to.setWithLayers([MyLayer])\n\t\t\tvar o2 = new AltLayerableObject();\n\t\t\to2.lookupLayersIn = [\"owner\"]\n\t\t\to2.owner = o;\n\n\t\t\tvar o3 = new AltLayerableObject();\n\t\t\to3.lookupLayersIn = [\"owner\"];\n\t\t\to3.owner = o2;\n\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to3.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\n\t{name: \".. (in owner.owner.owner) \", \n\t\trun: function(name) {\n\t\t\tvar o = new AltLayerableObject();\n\t\t\to.setWithLayers([MyLayer])\n\t\t\tvar o2 = new AltLayerableObject();\n\t\t\to2.lookupLayersIn = [\"owner\"]\n\t\t\to2.owner = o;\n\n\t\t\tvar o3 = new AltLayerableObject();\n\t\t\to3.lookupLayersIn = [\"owner\"];\n\t\t\to3.owner = o2;\n\n\t\t\tvar o4 = new AltLayerableObject();\n\t\t\to4.lookupLayersIn = [\"owner\"];\n\t\t\to4.owner = o3;\n\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to4.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\n\t{name: \".. (in owner.owner.owner FAIL)\", \n\t\trun: function(name) {\n\t\t\tvar o = new AltLayerableObject();\n\t\t\tvar o2 = new AltLayerableObject();\n\t\t\to2.lookupLayersIn = [\"owner\"]\n\t\t\to2.owner = o;\n\n\t\t\tvar o3 = new AltLayerableObject();\n\t\t\to3.lookupLayersIn = [\"owner\"];\n\t\t\to3.owner = o2;\n\n\t\t\tvar o4 = new AltLayerableObject();\n\t\t\to4.lookupLayersIn = [\"owner\"];\n\t\t\to4.owner = o3;\n\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to4.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\n]\n\nCopBenchmark.runDelayed = function runDelayed() {\n var benchmark = CopBenchmark.benchmarksToRun.shift();\n if (!benchmark) {\n\t\tCopBenchmark.printResults();\n \treturn\n };\n\t// console.log(\"run \" + benchmark.name)\n\t// console.profile(benchmark.name);\n\tbenchmark.run(benchmark.name);\n\t// console.profileEnd(benchmark.name);\n\tGlobal.setTimeout(runDelayed, 10);\n};\n\nCopBenchmark.result = \"ContextJS Benchmark\\n\" +\n\t\"Date:\\t \" + new Date() + \"\\n\" +\n\t\"Browser:\\t \" + navigator.userAgent + \"\\n\" +\n\t\"Revision:\\t \" + WikiNavigator.current.model.getOriginalRevision() + \"\\n\" + \n\t\"name \\tops\ttime\tops / time\\n\";\nCopBenchmark.runDelayed();\n\n\n\n\n\n\n\n\n\n\n\n\n\n"]]> 0; j--) { \n\t\t\tvar current = stack[j];\n\t\t\tif (current.withLayers) {\n\t\t\t\tfor(var i=0; i < current.withLayers.length; i++) {\n\t\t\t\t\tvar ea = current.withLayers[i];\n\t\t\t\t\tif ((allLayers.indexOf(ea) === -1) && (allWithoutLayers.indexOf(ea) === -1)) {\n\t\t\t\t\t\tallLayers.push(ea)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (current.withouLayers) {\n\t\t\t\tfor(var i=0; i < current.withoutLayers.length; i++) {\n\t\t\t\t\tvar ea = current.withoutLayers[i];\n\t\t\t\t\tvar ea = allWithoutLayers[i]\n\t\t\t\t\tallWithoutLayers.push(ea)\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\treturn result\n\t},\n\n\tstructuralLayers: function(result) {\n\t\tvar allLayers = result.withLayers;\n\t\tvar allWithoutLayers = result.withoutLayers;\n\t\tvar obj = this;\n\n\t\t// go ownerchain backward and gather all layer activations and deactivations\n\t\twhile(obj) {\t\t\n\t\t\t// don't use accessor methods because of speed... (not measured yet)\n\t\t\tif (obj.withLayers) {\n\t\t\t\tthis.collectWithLayersIn(obj.withLayers, result);\n\t\t\t};\n\t\t\tif (obj.withoutLayers) {\n\t\t\t\tthis.collectWithoutLayersIn(obj.withoutLayers, result);\n\t\t\t};\n\t\t\t// recurse, stop if owner is undefined\n\t\t\tobj = obj.owner\n\t\t}\n\t\treturn result;\n\t},\n\n\tglobalLayers: function(result) {\n\t\tthis.collectWithLayersIn(cop.GlobalLayers, result);\n\t\treturn result\n\t},\t\n\n});\n\n})\n\n\nObject.subclass('MyObject', {\n\n\tfoo1: function(a) {\n\t\treturn a * a\n\t},\n\n\tfoo2: function(a) {\n\t\treturn a * a\n\t},\n})\n\ncreateLayer(\"MyLayer\");\nlayerClass(MyLayer, MyObject, {\n\tfoo2: function(a) {\n\t\treturn cop.proceed(a) * a\n\t}\n})\n\nObject.subclass('MyStructuralObject', {\n\tfoo: function(a) {\n\t\treturn a * a\n\t},\n})\n\nlayerClass(MyLayer, MyStructuralObject, {\n\tfoo: function(a) {\n\t\treturn cop.proceed(a) * a\n\t}\n})\n\nLayerableObject.subclass(\"MyLayerableObject\", {\n\tfoo: function( a) {\n\t\treturn a * a\n\t}\n})\n\nlayerClass(MyLayer, MyLayerableObject, {\n\tfoo: function(a) {\n\t\treturn cop.proceed(a) * a\n\t}\n})\n\n\nLayerableObject.subclass(\"AltLayerableObject\", {\n\tfoo: function( a) {\n\t\treturn a * a\n\t},\n\n})\n\nlayerClass(MyLayer, AltLayerableObject, {\n\tfoo: function(a) {\n\t\treturn cop.proceed(a) * a\n\t}\n})\n\n\n\n// Benchmarks\n\nCopBenchmark.benchmarksToRun = [\n\t{name: \"PLAIN o.foo1() \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyObject();\n\t\t\tconsole.profile() \n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo1(i)\n\t\t\t\t}\n\t\t\t})\n\t\t\tconsole.profileEnd()\n\t\t}\n\t},\n\n\n\t{name: \"Instance specific o.foo1 \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyObject();\n\t\t\to.foo1 = function(a) {return a * a * a}\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo1(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \"Manual Wrap o.foo1 \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyObject();\n\t\t\tvar oldFunc = o.foo1;\n\t\t\to.foo1 = function(v) {oldFunc(v) * v}\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo1(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\n\t{name: \".. with apply arguments\", \n\t\trun: function(name) {\n\t\t\tvar o = new MyObject();\n\t\t\tvar oldFunc = o.foo1;\n\t\t\to.foo1 = function(v) {oldFunc.apply(o, arguments) * v}\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo1(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \".. with apply $A(arguments)\", \n\t\trun: function(name) {\n\t\t\tvar o = new MyObject();\n\t\t\tvar oldFunc = o.foo1;\n\t\t\to.foo1 = function(v) {oldFunc.apply(o, $A(arguments)) * v}\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo1(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \"Wrap o.foo1() \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyObject();\n\t\t\to.foo1 = o.foo1.wrap(function(p, v) { p(v) + v })\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo1(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \"Layered o.foo2() \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyObject();\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo2(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\t{name: \"Layer active o.foo2() \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyObject();\n\t\t\twithLayers([MyLayer], function() {\n\t\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\t\to.foo2(i)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\t},\n\t{name: \"activeLayers PLAIN \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyStructuralObject();\n\t\t\to.activeLayers = function() {return []};\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \"MyLayerableObject PLAIN\", \n\t\trun: function(name) {\n\t\t\tvar o = new MyLayerableObject();\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \"MyLayerableObject setWithLayers\", \n\t\trun: function(name) {\n\t\t\tvar o = new MyLayerableObject();\n\t\t\to.setWithLayers([MyLayer])\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \".. (in owner) \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyLayerableObject();\n\t\t\to.setWithLayers([MyLayer])\n\t\t\tvar o2 = new MyLayerableObject();\n\t\t\to2.lookupLayersIn = [\"owner\"]\n\t\t\to2.owner = o\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to2.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\n\t{name: \".. (owner.owner) \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyLayerableObject();\n\t\t\to.setWithLayers([MyLayer])\n\t\t\tvar o2 = new MyLayerableObject();\n\t\t\to2.lookupLayersIn = [\"owner\"]\n\t\t\to2.owner = o;\n\n\t\t\tvar o3 = new MyLayerableObject();\n\t\t\to3.lookupLayersIn = [\"owner\"];\n\t\t\to3.owner = o2;\n\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to3.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\n\t{name: \".. (in owner.owner.owner) \", \n\t\trun: function(name) {\n\t\t\tvar o = new MyLayerableObject();\n\t\t\to.setWithLayers([MyLayer])\n\t\t\tvar o2 = new MyLayerableObject();\n\t\t\to2.lookupLayersIn = [\"owner\"]\n\t\t\to2.owner = o;\n\n\t\t\tvar o3 = new MyLayerableObject();\n\t\t\to3.lookupLayersIn = [\"owner\"];\n\t\t\to3.owner = o2;\n\n\t\t\tvar o4 = new MyLayerableObject();\n\t\t\to4.lookupLayersIn = [\"owner\"];\n\t\t\to4.owner = o3;\n\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to4.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\n\t{name: \".. (in owner.owner.owner FAIL)\", \n\t\trun: function(name) {\n\t\t\tvar o = new MyLayerableObject();\n\t\t\tvar o2 = new MyLayerableObject();\n\t\t\to2.lookupLayersIn = [\"owner\"]\n\t\t\to2.owner = o;\n\n\t\t\tvar o3 = new MyLayerableObject();\n\t\t\to3.lookupLayersIn = [\"owner\"];\n\t\t\to3.owner = o2;\n\n\t\t\tvar o4 = new MyLayerableObject();\n\t\t\to4.lookupLayersIn = [\"owner\"];\n\t\t\to4.owner = o3;\n\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to4.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \"AltLayerableObj. PLAIN\", \n\t\trun: function(name) {\n\t\t\tvar o = new AltLayerableObject();\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \"AltLayerableObj. setWithLayers\", \n\t\trun: function(name) {\n\t\t\tvar o = new AltLayerableObject();\n\t\t\to.setWithLayers([MyLayer])\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\t{name: \".. (in owner) \", \n\t\trun: function(name) {\n\t\t\tvar o = new AltLayerableObject();\n\t\t\to.setWithLayers([MyLayer])\n\t\t\tvar o2 = new AltLayerableObject();\n\t\t\to2.lookupLayersIn = [\"owner\"]\n\t\t\to2.owner = o\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to2.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\n\t{name: \".. (owner.owner) \", \n\t\trun: function(name) {\n\t\t\tvar o = new AltLayerableObject();\n\t\t\to.setWithLayers([MyLayer])\n\t\t\tvar o2 = new AltLayerableObject();\n\t\t\to2.lookupLayersIn = [\"owner\"]\n\t\t\to2.owner = o;\n\n\t\t\tvar o3 = new AltLayerableObject();\n\t\t\to3.lookupLayersIn = [\"owner\"];\n\t\t\to3.owner = o2;\n\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to3.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\n\t{name: \".. (in owner.owner.owner) \", \n\t\trun: function(name) {\n\t\t\tvar o = new AltLayerableObject();\n\t\t\to.setWithLayers([MyLayer])\n\t\t\tvar o2 = new AltLayerableObject();\n\t\t\to2.lookupLayersIn = [\"owner\"]\n\t\t\to2.owner = o;\n\n\t\t\tvar o3 = new AltLayerableObject();\n\t\t\to3.lookupLayersIn = [\"owner\"];\n\t\t\to3.owner = o2;\n\n\t\t\tvar o4 = new AltLayerableObject();\n\t\t\to4.lookupLayersIn = [\"owner\"];\n\t\t\to4.owner = o3;\n\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to4.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\n\t{name: \".. (in owner.owner.owner FAIL)\", \n\t\trun: function(name) {\n\t\t\tvar o = new AltLayerableObject();\n\t\t\tvar o2 = new AltLayerableObject();\n\t\t\to2.lookupLayersIn = [\"owner\"]\n\t\t\to2.owner = o;\n\n\t\t\tvar o3 = new AltLayerableObject();\n\t\t\to3.lookupLayersIn = [\"owner\"];\n\t\t\to3.owner = o2;\n\n\t\t\tvar o4 = new AltLayerableObject();\n\t\t\to4.lookupLayersIn = [\"owner\"];\n\t\t\to4.owner = o3;\n\n\t\t\tCopBenchmark.benchmarkBlock(name, 1, function(size, obj) {\n\t\t\t\tfor(var i = 0; i < size; i++) {\t\t\n\t\t\t\t\to4.foo(i)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t},\n\n\n]\n\nCopBenchmark.runDelayed = function runDelayed() {\n var benchmark = CopBenchmark.benchmarksToRun.shift();\n if (!benchmark) {\n\t\tCopBenchmark.printResults();\n \treturn\n };\n\t// console.log(\"run \" + benchmark.name)\n\t// console.profile(benchmark.name);\n\tbenchmark.run(benchmark.name);\n\t// console.profileEnd(benchmark.name);\n\tGlobal.setTimeout(runDelayed, 10);\n};\n\nCopBenchmark.result = \"ContextJS Benchmark\\n\" +\n\t\"Date:\\t \" + new Date() + \"\\n\" +\n\t\"Browser:\\t \" + navigator.userAgent + \"\\n\" +\n\t\"Revision:\\t \" + WikiNavigator.current.model.getOriginalRevision() + \"\\n\" + \n\t\"name \\tops\ttime\tops / time\\n\";\nCopBenchmark.runDelayed();\n\n\n\n\n\n\n\n\n\n\n\n\n\n"]]>119984143truetruefalse119989truetrue 119992 false1199910.250204132805610270.11 true false119988 true 119997 nullfalse119998truenull Workspace120001falsenulltruefalse X120005falsenulltrue false120004 false M120009falsenulltrue false120008 false 120013falsenulltrue false120012 false119996nullfalse119995falsenullnullnullnullfalse null69