made with requirebin
Last active
August 29, 2015 14:27
-
-
Save kirbysayshi/a246ee25bcf9bad34ac4 to your computer and use it in GitHub Desktop.
requirebin sketch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Benchmark = require('benchmark'); | |
var suite = new Benchmark.Suite; | |
global.moutdifference = require('mout/array/difference'); | |
global.assert = require('assert'); | |
function setup() { | |
destArr = []; | |
var worstCaseArr1 = []; | |
var worstCaseArr2 = []; | |
for (var i = 0; i < 50; i++) { | |
worstCaseArr1.push('prop1_' + i); | |
worstCaseArr2.push('prop2_' + i); | |
} | |
// Basically an inlined version of mout/array/difference, | |
// but the first parameter is the destination array to give | |
// a bit of GC control back to the developer. | |
function diffN(out, a, b, n) { | |
if (a !== out) out.push.apply(out, a); | |
for (var i = 2; i < arguments.length; i++) { | |
var arr = arguments[i]; | |
for (var k = 0; k < arr.length; k++) { | |
var idx = out.indexOf(arr[k]); | |
if (idx !== -1) { | |
out.splice(idx,1); | |
} | |
} | |
} | |
return out; | |
} | |
// This can only diff two arrays, instead of N like mout. | |
// The first parameter is the destination array to give | |
// a bit of GC control back to the developer. | |
function diff2(out, a, b) { | |
if (a !== out) out.push.apply(out, a); | |
var arr = b; | |
for (var k = 0; k < b.length; k++) { | |
var idx = out.indexOf(b[k]); | |
if (idx !== -1) { | |
out.splice(idx,1); | |
} | |
} | |
return out; | |
} | |
} | |
function reset() { | |
destArr.length = 0; | |
} | |
var bopts = { setup: setup, start: reset, cycle: reset, teardown: reset }; | |
suite | |
.add('mout/array/difference', function() { | |
destArr.length = 0; | |
var d = moutdifference(worstCaseArr1, worstCaseArr2); | |
assert(d[0], 'prop1_0'); | |
}, bopts) | |
.add('diffN with new array', function() { | |
destArr.length = 0; | |
var d = diffN([], worstCaseArr1, worstCaseArr2); | |
assert(d[0], 'prop1_0'); | |
}, bopts) | |
.add('diffN with existing array', function() { | |
destArr.length = 0; | |
var d = diffN(destArr, worstCaseArr1, worstCaseArr2); | |
assert(d[0], 'prop1_0'); | |
}, bopts) | |
.add('diff2 with new array', function() { | |
destArr.length = 0; | |
var d = diff2([], worstCaseArr1, worstCaseArr2); | |
assert(d[0], 'prop1_0'); | |
}, bopts) | |
.add('diff2 with existing array', function() { | |
destArr.length = 0; | |
var d = diff2(destArr, worstCaseArr1, worstCaseArr2); | |
assert(d[0], 'prop1_0'); | |
}, bopts) | |
.add('manual loop with new array', function() { | |
destArr.length = 0; | |
var out = []; | |
out.push.apply(out, worstCaseArr1); | |
for (var i = 0, len = worstCaseArr2.length; i < len; i++) { | |
var found = out.indexOf(worstCaseArr2[i]); | |
if (found > -1) { | |
out.splice(found, 1); | |
} | |
} | |
}, bopts) | |
.add('manual loop with existing array', function() { | |
destArr.length = 0; | |
var out = destArr; | |
out.push.apply(out, worstCaseArr1); | |
for (var i = 0, len = worstCaseArr2.length; i < len; i++) { | |
var found = out.indexOf(worstCaseArr2[i]); | |
if (found > -1) { | |
out.splice(found, 1); | |
} | |
} | |
}, bopts) | |
// add listeners | |
.on('cycle', function(event) { | |
console.log(String(event.target)); | |
}) | |
.on('complete', function() { | |
console.log('Fastest is ' + this.filter('fastest').pluck('name')); | |
}) | |
.on('error', console.error.bind(console)) | |
// run async | |
.run({ 'async': false }); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canMutationObserver=typeof window!=="undefined"&&window.MutationObserver;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}var queue=[];if(canMutationObserver){var hiddenDiv=document.createElement("div");var observer=new MutationObserver(function(){var queueList=queue.slice();queue.length=0;queueList.forEach(function(fn){fn()})});observer.observe(hiddenDiv,{attributes:true});return function nextTick(fn){if(!queue.length){hiddenDiv.setAttribute("yes","no")}queue.push(fn)}}if(canPost){window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],benchmark:[function(require,module,exports){(function(process,global){(function(window,undefined){"use strict";var counter=0;var doc=isHostType(window,"document")&&document;var freeDefine=typeof define=="function"&&typeof define.amd=="object"&&define.amd&&define;var freeExports=typeof exports=="object"&&exports&&(typeof global=="object"&&global&&global==global.global&&(window=global),exports);var freeRequire=typeof require=="function"&&require;var getAllKeys=Object.getOwnPropertyNames;var getDescriptor=Object.getOwnPropertyDescriptor;var hasOwnProperty={}.hasOwnProperty;var isExtensible=Object.isExtensible||function(){return true};var microtimeObject=req("microtime");var perfObject=isHostType(window,"performance")&&performance;var perfName=perfObject&&(perfObject.now&&"now"||perfObject.webkitNow&&"webkitNow");var processObject=isHostType(window,"process")&&process;var propertyIsEnumerable={}.propertyIsEnumerable;var setDescriptor=Object.defineProperty;var toString={}.toString;var trash=doc&&doc.createElement("div");var uid="uid"+ +new Date;var calledBy={};var divisors={1:4096,2:512,3:64,4:8,5:0};var tTable={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96};var uTable={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};var support={};(function(){support.air=isClassOf(window.runtime,"ScriptBridgingProxyObject");support.argumentsClass=isClassOf(arguments,"Arguments");support.browser=doc&&isHostType(window,"navigator");support.charByIndex="x"[0]+Object("x")[0]=="xx";support.charByOwnIndex=support.charByIndex&&hasKey("x","0");support.java=isClassOf(window.java,"JavaPackage");support.timeout=isHostType(window,"setTimeout")&&isHostType(window,"clearTimeout");try{support.decompilation=Function("return ("+function(x){return{x:""+(1+x)+"",y:0}}+")")()(0).x==="1"}catch(e){support.decompilation=false}try{var o={};support.descriptors=(setDescriptor(o,o,o),"value"in getDescriptor(o,o))}catch(e){support.descriptors=false}try{support.getAllKeys=/\bvalueOf\b/.test(getAllKeys(Object.prototype))}catch(e){support.getAllKeys=false}support.iteratesOwnFirst=function(){var props=[];function ctor(){this.x=1}ctor.prototype={y:1};for(var prop in new ctor){props.push(prop)}return props[0]=="x"}();try{support.nodeClass=({toString:0}+"",toString.call(doc||0)!="[object Object]")}catch(e){support.nodeClass=true}})();var timer={ns:Date,start:null,stop:null};var noArgumentsClass=!support.argumentsClass,noCharByIndex=!support.charByIndex,noCharByOwnIndex=!support.charByOwnIndex;var abs=Math.abs,floor=Math.floor,max=Math.max,min=Math.min,pow=Math.pow,sqrt=Math.sqrt;function Benchmark(name,fn,options){var me=this;if(me==null||me.constructor!=Benchmark){return new Benchmark(name,fn,options)}if(isClassOf(name,"Object")){options=name}else if(isClassOf(name,"Function")){options=fn;fn=name}else if(isClassOf(fn,"Object")){options=fn;fn=null;me.name=name}else{me.name=name}setOptions(me,options);me.id||(me.id=++counter);me.fn==null&&(me.fn=fn);me.stats=deepClone(me.stats);me.times=deepClone(me.times)}function Deferred(clone){var me=this;if(me==null||me.constructor!=Deferred){return new Deferred(clone)}me.benchmark=clone;clock(me)}function Event(type){var me=this;return me==null||me.constructor!=Event?new Event(type):type instanceof Event?type:extend(me,{timeStamp:+new Date},typeof type=="string"?{type:type}:type)}function Suite(name,options){var me=this;if(me==null||me.constructor!=Suite){return new Suite(name,options)}if(isClassOf(name,"Object")){options=name}else{me.name=name}setOptions(me,options)}function concat(){var value,j=-1,length=arguments.length,result=slice.call(this),index=result.length;while(++j<length){value=arguments[j];if(isClassOf(value,"Array")){for(var k=0,l=value.length;k<l;k++,index++){if(k in value){result[index]=value[k]}}}else{result[index++]=value}}return result}function insert(start,deleteCount,elements){var deleteEnd=start+deleteCount,elementCount=elements?elements.length:0,index=start-1,length=start+elementCount,object=this,result=Array(deleteCount),tail=slice.call(object,deleteEnd);while(++index<deleteEnd){if(index in object){result[index-start]=object[index];delete object[index]}}index=start-1;while(++index<length){object[index]=elements[index-start]}start=index--;length=max(0,(object.length>>>0)-deleteCount+elementCount);while(++index<length){if(index-start in tail){object[index]=tail[index-start]}else if(index in object){delete object[index]}}deleteCount=deleteCount>elementCount?deleteCount-elementCount:0;while(deleteCount--){index=length+deleteCount;if(index in object){delete object[index]}}object.length=length;return result}function reverse(){var upperIndex,value,index=-1,object=Object(this),length=object.length>>>0,middle=floor(length/2);if(length>1){while(++index<middle){upperIndex=length-index-1;value=upperIndex in object?object[upperIndex]:uid;if(index in object){object[upperIndex]=object[index]}else{delete object[upperIndex]}if(value!=uid){object[index]=value}else{delete object[index]}}}return object}function shift(){return insert.call(this,0,1)[0]}function slice(start,end){var index=-1,object=Object(this),length=object.length>>>0,result=[];start=toInteger(start);start=start<0?max(length+start,0):min(start,length);start--;end=end==null?length:toInteger(end);end=end<0?max(length+end,0):min(end,length);while((++index,++start)<end){if(start in object){result[index]=object[start]}}return result}function splice(start,deleteCount){var object=Object(this),length=object.length>>>0;start=toInteger(start);start=start<0?max(length+start,0):min(start,length);deleteCount=arguments.length==1?length-start:min(max(toInteger(deleteCount),0),length-start);return insert.call(object,start,deleteCount,slice.call(arguments,2))}function toInteger(value){value=+value;return value===0||!isFinite(value)?value||0:value-value%1}function unshift(){var object=Object(this);insert.call(object,0,0,arguments);return object.length}function bind(fn,thisArg){return function(){fn.apply(thisArg,arguments)}}function createFunction(){createFunction=function(args,body){var result,anchor=freeDefine?define.amd:Benchmark,prop=uid+"createFunction";runScript((freeDefine?"define.amd.":"Benchmark.")+prop+"=function("+args+"){"+body+"}");result=anchor[prop];delete anchor[prop];return result};createFunction=support.browser&&(createFunction("",'return"'+uid+'"')||noop)()==uid?createFunction:Function;return createFunction.apply(null,arguments)}function delay(bench,fn){bench._timerId=setTimeout(fn,bench.delay*1e3)}function destroyElement(element){trash.appendChild(element);trash.innerHTML=""}function forProps(){var forShadowed,skipSeen,forArgs=true,shadowed=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"];(function(enumFlag,key){function Klass(){this.valueOf=0}Klass.prototype.valueOf=0;for(key in new Klass){enumFlag+=key=="valueOf"?1:0}for(key in arguments){key=="0"&&(forArgs=false)}skipSeen=enumFlag==2;forShadowed=!enumFlag})(0);forProps=function(object,callback,options){options||(options={});var result=object;object=Object(object);var ctor,key,keys,skipCtor,done=!result,which=options.which,allFlag=which=="all",index=-1,iteratee=object,length=object.length,ownFlag=allFlag||which=="own",seen={},skipProto=isClassOf(object,"Function"),thisArg=options.bind;if(thisArg!==undefined){callback=bind(callback,thisArg)}if(allFlag&&support.getAllKeys){for(index=0,keys=getAllKeys(object),length=keys.length;index<length;index++){key=keys[index];if(callback(object[key],key,object)===false){break}}}else{for(key in object){if(done=!(skipProto&&key=="prototype")&&!(skipSeen&&(hasKey(seen,key)||!(seen[key]=true)))&&(!ownFlag||ownFlag&&hasKey(object,key))&&callback(object[key],key,object)===false){break}}if(!done&&(forArgs&&isArguments(object)||(noCharByIndex||noCharByOwnIndex)&&isClassOf(object,"String")&&(iteratee=noCharByIndex?object.split(""):object))){while(++index<length){if(done=callback(iteratee[index],String(index),object)===false){break}}}if(!done&&forShadowed){ctor=object.constructor;skipCtor=ctor&&ctor.prototype&&ctor.prototype.constructor===ctor;for(index=0;index<7;index++){key=shadowed[index];if(!(skipCtor&&key=="constructor")&&hasKey(object,key)&&callback(object[key],key,object)===false){break}}}}return result};return forProps.apply(null,arguments)}function getFirstArgument(fn){return!hasKey(fn,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(fn)||0)[1]||""}function getMean(sample){return reduce(sample,function(sum,x){return sum+x})/sample.length||0}function getSource(fn,altSource){var result=altSource;if(isStringable(fn)){result=String(fn)}else if(support.decompilation){result=(/^[^{]+\{([\s\S]*)}\s*$/.exec(fn)||0)[1]}result=(result||"").replace(/^\s+|\s+$/g,"");return/^(?:\/\*+[\w|\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(result)?"":result}function isArguments(){isArguments=function(value){return toString.call(value)=="[object Arguments]"};if(noArgumentsClass){isArguments=function(value){return hasKey(value,"callee")&&!(propertyIsEnumerable&&propertyIsEnumerable.call(value,"callee"))}}return isArguments(arguments[0])}function isClassOf(value,name){return value!=null&&toString.call(value)=="[object "+name+"]"}function isHostType(object,property){var type=object!=null?typeof object[property]:"number";return!/^(?:boolean|number|string|undefined)$/.test(type)&&(type=="object"?!!object[property]:true)}function isPlainObject(value){var result=false;if(!(value&&typeof value=="object")||noArgumentsClass&&isArguments(value)){return result}var ctor=value.constructor;if((support.nodeClass||!(typeof value.toString!="function"&&typeof(value+"")=="string"))&&(!isClassOf(ctor,"Function")||ctor instanceof ctor)){if(support.iteratesOwnFirst){forProps(value,function(subValue,subKey){result=subKey});return result===false||hasKey(value,result)}forProps(value,function(subValue,subKey){result=!hasKey(value,subKey);return false});return result===false}return result}function isStringable(value){return hasKey(value,"toString")||isClassOf(value,"String")}function methodize(fn){return function(){var args=[this];args.push.apply(args,arguments);return fn.apply(null,args)}}function noop(){}function req(id){try{var result=freeExports&&freeRequire(id)}catch(e){}return result||null}function runScript(code){var anchor=freeDefine?define.amd:Benchmark,script=doc.createElement("script"),sibling=doc.getElementsByTagName("script")[0],parent=sibling.parentNode,prop=uid+"runScript",prefix="("+(freeDefine?"define.amd.":"Benchmark.")+prop+"||function(){})();";try{script.appendChild(doc.createTextNode(prefix+code));anchor[prop]=function(){destroyElement(script)}}catch(e){parent=parent.cloneNode(false);sibling=null;script.text=code}parent.insertBefore(script,sibling);delete anchor[prop]}function setOptions(bench,options){options=extend({},bench.constructor.options,options);bench.options=forOwn(options,function(value,key){if(value!=null){if(/^on[A-Z]/.test(key)){forEach(key.split(" "),function(key){bench.on(key.slice(2).toLowerCase(),value)})}else if(!hasKey(bench,key)){bench[key]=deepClone(value)}}})}function resolve(){var me=this,clone=me.benchmark,bench=clone._original;if(bench.aborted){me.teardown();clone.running=false;cycle(me)}else if(++me.cycles<clone.count){if(support.timeout){setTimeout(function(){clone.compiled.call(me,timer)},0)}else{clone.compiled.call(me,timer)}}else{timer.stop(me);me.teardown();delay(clone,function(){cycle(me)})}}function deepClone(value){var accessor,circular,clone,ctor,descriptor,extensible,key,length,markerKey,parent,result,source,subIndex,data={value:value},index=0,marked=[],queue={length:0},unmarked=[];function Marker(object){this.raw=object}function forPropsCallback(subValue,subKey){if(subValue&&subValue.constructor==Marker){return}if(subValue===Object(subValue)){queue[queue.length++]={key:subKey,parent:clone,source:value}}else{try{clone[subKey]=subValue}catch(e){}}}function getMarkerKey(object){var result=uid;while(object[result]&&object[result].constructor!=Marker){result+=1}return result}do{key=data.key;parent=data.parent;source=data.source;clone=value=source?source[key]:data.value;accessor=circular=descriptor=false;if(value===Object(value)){if(isClassOf(value.deepClone,"Function")){clone=value.deepClone()}else{ctor=value.constructor;switch(toString.call(value)){case"[object Array]":clone=new ctor(value.length);break;case"[object Boolean]":clone=new ctor(value==true);break;case"[object Date]":clone=new ctor(+value);break;case"[object Object]":isPlainObject(value)&&(clone={});break;case"[object Number]":case"[object String]":clone=new ctor(value);break;case"[object RegExp]":clone=ctor(value.source,(value.global?"g":"")+(value.ignoreCase?"i":"")+(value.multiline?"m":""))}}if(clone&&clone!=value&&!(descriptor=source&&support.descriptors&&getDescriptor(source,key),accessor=descriptor&&(descriptor.get||descriptor.set))){if(extensible=isExtensible(value)){markerKey=getMarkerKey(value);if(value[markerKey]){circular=clone=value[markerKey].raw}}else{for(subIndex=0,length=unmarked.length;subIndex<length;subIndex++){data=unmarked[subIndex];if(data.object===value){circular=clone=data.clone;break}}}if(!circular){if(extensible){value[markerKey]=new Marker(clone);marked.push({key:markerKey,object:value})}else{unmarked.push({clone:clone,object:value})}forProps(value,forPropsCallback,{which:"all"})}}}if(parent){if(accessor||descriptor&&!(descriptor.configurable&&descriptor.enumerable&&descriptor.writable)){if("value"in descriptor){descriptor.value=clone}setDescriptor(parent,key,descriptor)}else{parent[key]=clone}}else{result=clone}}while(data=queue[index++]);for(index=0,length=marked.length;index<length;index++){data=marked[index];delete data.object[data.key]}return result}function each(object,callback,thisArg){var result=object;object=Object(object);var fn=callback,index=-1,length=object.length,isSnapshot=!!(object.snapshotItem&&(length=object.snapshotLength)),isSplittable=(noCharByIndex||noCharByOwnIndex)&&isClassOf(object,"String"),isConvertable=isSnapshot||isSplittable||"item"in object,origObject=object;if(length===length>>>0){if(isConvertable){callback=function(value,index){return fn.call(this,value,index,origObject)};if(isSplittable){object=object.split("")}else{object=[];while(++index<length){object[index]=isSnapshot?result.snapshotItem(index):result[index]}}}forEach(object,callback,thisArg)}else{forOwn(object,callback,thisArg)}return result}function extend(destination,source){var result=destination;delete arguments[0];forEach(arguments,function(source){forProps(source,function(value,key){result[key]=value})});return result}function filter(array,callback,thisArg){var result;if(callback=="successful"){callback=function(bench){return bench.cycles&&isFinite(bench.hz)}}else if(callback=="fastest"||callback=="slowest"){result=filter(array,"successful").sort(function(a,b){a=a.stats;b=b.stats;return(a.mean+a.moe>b.mean+b.moe?1:-1)*(callback=="fastest"?1:-1)});result=filter(result,function(bench){return result[0].compare(bench)==0})}return result||reduce(array,function(result,value,index){return callback.call(thisArg,value,index,array)?(result.push(value),result):result},[])}function forEach(array,callback,thisArg){var index=-1,length=(array=Object(array)).length>>>0;if(thisArg!==undefined){callback=bind(callback,thisArg)}while(++index<length){if(index in array&&callback(array[index],index,array)===false){break}}return array}function forOwn(object,callback,thisArg){return forProps(object,callback,{bind:thisArg,which:"own"})}function formatNumber(number){number=String(number).split(".");return number[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(number[1]?"."+number[1]:"")}function hasKey(){hasKey=function(object,key){var parent=object!=null&&(object.constructor||Object).prototype;return!!parent&&key in Object(object)&&!(key in parent&&object[key]===parent[key])};if(isClassOf(hasOwnProperty,"Function")){hasKey=function(object,key){return object!=null&&hasOwnProperty.call(object,key)}}else if({}.__proto__==Object.prototype){hasKey=function(object,key){var result=false;if(object!=null){object=Object(object);object.__proto__=[object.__proto__,object.__proto__=null,result=key in object][0]}return result}}return hasKey.apply(this,arguments)}function indexOf(array,value,fromIndex){var index=toInteger(fromIndex),length=(array=Object(array)).length>>>0;index=(index<0?max(0,length+index):index)-1;while(++index<length){if(index in array&&value===array[index]){return index}}return-1}function interpolate(string,object){forOwn(object,function(value,key){string=string.replace(RegExp("#\\{"+key.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")+"\\}","g"),value)});return string}function invoke(benches,name){var args,bench,queued,index=-1,eventProps={currentTarget:benches},options={onStart:noop,onCycle:noop,onComplete:noop},result=map(benches,function(bench){return bench});function execute(){var listeners,async=isAsync(bench);if(async){bench.on("complete",getNext);listeners=bench.events.complete;listeners.splice(0,0,listeners.pop())}result[index]=isClassOf(bench&&bench[name],"Function")?bench[name].apply(bench,args):undefined;return!async&&getNext()}function getNext(event){var cycleEvent,last=bench,async=isAsync(last);if(async){last.off("complete",getNext);last.emit("complete")}eventProps.type="cycle";eventProps.target=last;cycleEvent=Event(eventProps);options.onCycle.call(benches,cycleEvent);if(!cycleEvent.aborted&&raiseIndex()!==false){bench=queued?benches[0]:result[index];if(isAsync(bench)){delay(bench,execute)}else if(async){while(execute()){}}else{return true}}else{eventProps.type="complete";options.onComplete.call(benches,Event(eventProps))}if(event){event.aborted=true}else{return false}}function isAsync(object){var async=args[0]&&args[0].async;return Object(object).constructor==Benchmark&&name=="run"&&((async==null?object.options.async:async)&&support.timeout||object.defer)}function raiseIndex(){var length=result.length;if(queued){do{++index>0&&shift.call(benches)}while((length=benches.length)&&!("0"in benches))}else{while(++index<length&&!(index in result)){}}return(queued?length:index<length)?index:index=false}if(isClassOf(name,"String")){args=slice.call(arguments,2)}else{options=extend(options,name);name=options.name;args=isClassOf(args="args"in options?options.args:[],"Array")?args:[args];queued=options.queued}if(raiseIndex()!==false){bench=result[index];eventProps.type="start";eventProps.target=bench;options.onStart.call(benches,Event(eventProps));if(benches.aborted&&benches.constructor==Suite&&name=="run"){eventProps.type="cycle";options.onCycle.call(benches,Event(eventProps));eventProps.type="complete";options.onComplete.call(benches,Event(eventProps))}else{if(isAsync(bench)){delay(bench,execute)}else{while(execute()){}}}}return result}function join(object,separator1,separator2){var result=[],length=(object=Object(object)).length,arrayLike=length===length>>>0;separator2||(separator2=": ");each(object,function(value,key){result.push(arrayLike?value:key+separator2+value)});return result.join(separator1||",")}function map(array,callback,thisArg){return reduce(array,function(result,value,index){result[index]=callback.call(thisArg,value,index,array);return result},Array(Object(array).length>>>0))}function pluck(array,property){return map(array,function(object){return object==null?undefined:object[property]})}function reduce(array,callback,accumulator){var noaccum=arguments.length<3;forEach(array,function(value,index){accumulator=noaccum?(noaccum=false,value):callback(accumulator,value,index,array)});return accumulator}function abortSuite(){var event,me=this,resetting=calledBy.resetSuite;if(me.running){event=Event("abort");me.emit(event);if(!event.cancelled||resetting){calledBy.abortSuite=true;me.reset();delete calledBy.abortSuite;if(!resetting){me.aborted=true;invoke(me,"abort")}}}return me}function add(name,fn,options){var me=this,bench=Benchmark(name,fn,options),event=Event({type:"add",target:bench});if(me.emit(event),!event.cancelled){me.push(bench)}return me}function cloneSuite(options){var me=this,result=new me.constructor(extend({},me.options,options));forOwn(me,function(value,key){if(!hasKey(result,key)){result[key]=value&&isClassOf(value.clone,"Function")?value.clone():deepClone(value)}});return result}function filterSuite(callback){var me=this,result=new me.constructor;result.push.apply(result,filter(me,callback));return result}function resetSuite(){var event,me=this,aborting=calledBy.abortSuite;if(me.running&&!aborting){calledBy.resetSuite=true;me.abort();delete calledBy.resetSuite}else if((me.aborted||me.running)&&(me.emit(event=Event("reset")),!event.cancelled)){me.running=false;if(!aborting){invoke(me,"reset")}}return me}function runSuite(options){var me=this;me.reset();me.running=true;options||(options={});invoke(me,{name:"run",args:options,queued:options.queued,onStart:function(event){me.emit(event)},onCycle:function(event){var bench=event.target;if(bench.error){me.emit({type:"error",target:bench})}me.emit(event);event.aborted=me.aborted},onComplete:function(event){me.running=false;me.emit(event)}});return me}function emit(type){var listeners,me=this,event=Event(type),events=me.events,args=(arguments[0]=event,arguments);event.currentTarget||(event.currentTarget=me);event.target||(event.target=me);delete event.result;if(events&&(listeners=hasKey(events,event.type)&&events[event.type])){forEach(listeners.slice(),function(listener){if((event.result=listener.apply(me,args))===false){event.cancelled=true}return!event.aborted})}return event.result}function listeners(type){var me=this,events=me.events||(me.events={});return hasKey(events,type)?events[type]:events[type]=[]}function off(type,listener){var me=this,events=me.events;events&&each(type?type.split(" "):events,function(listeners,type){var index;if(typeof listeners=="string"){type=listeners;listeners=hasKey(events,type)&&events[type]}if(listeners){if(listener){index=indexOf(listeners,listener);if(index>-1){listeners.splice(index,1)}}else{listeners.length=0}}});return me}function on(type,listener){var me=this,events=me.events||(me.events={});forEach(type.split(" "),function(type){(hasKey(events,type)?events[type]:events[type]=[]).push(listener)});return me}function abort(){var event,me=this,resetting=calledBy.reset;if(me.running){event=Event("abort");me.emit(event);if(!event.cancelled||resetting){calledBy.abort=true;me.reset();delete calledBy.abort;if(support.timeout){clearTimeout(me._timerId);delete me._timerId}if(!resetting){me.aborted=true;me.running=false}}}return me}function clone(options){var me=this,result=new me.constructor(extend({},me,options));result.options=extend({},me.options,options);forOwn(me,function(value,key){if(!hasKey(result,key)){result[key]=deepClone(value)}});return result}function compare(other){var critical,zStat,me=this,sample1=me.stats.sample,sample2=other.stats.sample,size1=sample1.length,size2=sample2.length,maxSize=max(size1,size2),minSize=min(size1,size2),u1=getU(sample1,sample2),u2=getU(sample2,sample1),u=min(u1,u2);function getScore(xA,sampleB){return reduce(sampleB,function(total,xB){return total+(xB>xA?0:xB<xA?1:.5)},0)}function getU(sampleA,sampleB){return reduce(sampleA,function(total,xA){return total+getScore(xA,sampleB)},0)}function getZ(u){return(u-size1*size2/2)/sqrt(size1*size2*(size1+size2+1)/12)}if(me==other){return 0}if(size1+size2>30){zStat=getZ(u);return abs(zStat)>1.96?zStat>0?-1:1:0}critical=maxSize<5||minSize<3?0:uTable[maxSize][minSize-3];return u<=critical?u==u1?1:-1:0}function reset(){var data,event,me=this,index=0,changes={length:0},queue={length:0};if(me.running&&!calledBy.abort){calledBy.reset=true;me.abort();delete calledBy.reset}else{data={destination:me,source:extend({},me.constructor.prototype,me.options)};do{forOwn(data.source,function(value,key){var changed,destination=data.destination,currValue=destination[key];if(value&&typeof value=="object"){if(isClassOf(value,"Array")){if(!isClassOf(currValue,"Array")){changed=currValue=[]}if(currValue.length!=value.length){changed=currValue=currValue.slice(0,value.length);currValue.length=value.length}}else if(!currValue||typeof currValue!="object"){changed=currValue={}}if(changed){changes[changes.length++]={destination:destination,key:key,value:currValue}}queue[queue.length++]={destination:currValue,source:value}}else if(value!==currValue&&!(value==null||isClassOf(value,"Function"))){changes[changes.length++]={destination:destination,key:key,value:value}}})}while(data=queue[index++]);if(changes.length&&(me.emit(event=Event("reset")),!event.cancelled)){forEach(changes,function(data){data.destination[data.key]=data.value})}}return me}function toStringBench(){var me=this,error=me.error,hz=me.hz,id=me.id,stats=me.stats,size=stats.sample.length,pm=support.java?"+/-":"±",result=me.name||(isNaN(id)?id:"<Test #"+id+">");if(error){result+=": "+join(error)}else{result+=" x "+formatNumber(hz.toFixed(hz<100?2:0))+" ops/sec "+pm+stats.rme.toFixed(2)+"% ("+size+" run"+(size==1?"":"s")+" sampled)"}return result}function clock(){var applet,options=Benchmark.options,template={begin:"s$=new n$",end:"r$=(new n$-s$)/1e3",uid:uid},timers=[{ns:timer.ns,res:max(.0015,getRes("ms")),unit:"ms"}];clock=function(clone){var deferred;if(clone instanceof Deferred){deferred=clone;clone=deferred.benchmark}var bench=clone._original,fn=bench.fn,fnArg=deferred?getFirstArgument(fn)||"deferred":"",stringable=isStringable(fn);var source={setup:getSource(bench.setup,preprocess("m$.setup()")),fn:getSource(fn,preprocess("m$.fn("+fnArg+")")),fnArg:fnArg,teardown:getSource(bench.teardown,preprocess("m$.teardown()"))};var count=bench.count=clone.count,decompilable=support.decompilation||stringable,id=bench.id,isEmpty=!(source.fn||stringable),name=bench.name||(typeof id=="number"?"<Test #"+id+">":id),ns=timer.ns,result=0;clone.minTime=bench.minTime||(bench.minTime=bench.options.minTime=options.minTime);if(applet){try{ns.nanoTime()}catch(e){ns=timer.ns=new applet.Packages.nano}}var compiled=bench.compiled=createFunction(preprocess("t$"),interpolate(preprocess(deferred?"var d$=this,#{fnArg}=d$,m$=d$.benchmark._original,f$=m$.fn,su$=m$.setup,td$=m$.teardown;"+"if(!d$.cycles){"+'d$.fn=function(){var #{fnArg}=d$;if(typeof f$=="function"){try{#{fn}\n}catch(e$){f$(d$)}}else{#{fn}\n}};'+'d$.teardown=function(){d$.cycles=0;if(typeof td$=="function"){try{#{teardown}\n}catch(e$){td$()}}else{#{teardown}\n}};'+'if(typeof su$=="function"){try{#{setup}\n}catch(e$){su$()}}else{#{setup}\n};'+"t$.start(d$);"+"}d$.fn();return{}":"var r$,s$,m$=this,f$=m$.fn,i$=m$.count,n$=t$.ns;#{setup}\n#{begin};"+'while(i$--){#{fn}\n}#{end};#{teardown}\nreturn{elapsed:r$,uid:"#{uid}"}'),source));try{if(isEmpty){throw new Error('The test "'+name+'" is empty. This may be the result of dead code removal.')}else if(!deferred){bench.count=1;compiled=(compiled.call(bench,timer)||{}).uid==uid&&compiled;bench.count=count}}catch(e){compiled=null;clone.error=e||new Error(String(e));bench.count=count}if(decompilable&&!compiled&&!deferred&&!isEmpty){compiled=createFunction(preprocess("t$"),interpolate(preprocess((clone.error&&!stringable?"var r$,s$,m$=this,f$=m$.fn,i$=m$.count":"function f$(){#{fn}\n}var r$,s$,m$=this,i$=m$.count")+",n$=t$.ns;#{setup}\n#{begin};m$.f$=f$;while(i$--){m$.f$()}#{end};"+"delete m$.f$;#{teardown}\nreturn{elapsed:r$}"),source));try{bench.count=1;compiled.call(bench,timer);bench.compiled=compiled;bench.count=count;delete clone.error}catch(e){bench.count=count;if(clone.error){compiled=null}else{bench.compiled=compiled;clone.error=e||new Error(String(e))}}}clone.compiled=compiled;if(!clone.error){result=compiled.call(deferred||bench,timer).elapsed}return result};function getRes(unit){var measured,begin,count=30,divisor=1e3,ns=timer.ns,sample=[];while(count--){if(unit=="us"){divisor=1e6;if(ns.stop){ns.start();while(!(measured=ns.microseconds())){}}else if(ns[perfName]){divisor=1e3;measured=Function("n","var r,s=n."+perfName+"();while(!(r=n."+perfName+"()-s)){};return r")(ns)}else{begin=ns();while(!(measured=ns()-begin)){}}}else if(unit=="ns"){divisor=1e9;if(ns.nanoTime){begin=ns.nanoTime();while(!(measured=ns.nanoTime()-begin)){}}else{begin=(begin=ns())[0]+begin[1]/divisor;while(!(measured=(measured=ns())[0]+measured[1]/divisor-begin)){}divisor=1}}else{begin=new ns;while(!(measured=new ns-begin)){}}if(measured>0){sample.push(measured)}else{sample.push(Infinity);break; | |
}}return getMean(sample)/divisor}function preprocess(code){return interpolate(code,template).replace(/\$/g,/\d+/.exec(uid))}each(doc&&doc.applets||[],function(element){return!(timer.ns=applet="nanoTime"in element&&element)});try{if(typeof timer.ns.nanoTime()=="number"){timers.push({ns:timer.ns,res:getRes("ns"),unit:"ns"})}}catch(e){}try{if(timer.ns=new(window.chrome||window.chromium).Interval){timers.push({ns:timer.ns,res:getRes("us"),unit:"us"})}}catch(e){}if(timer.ns=perfName&&perfObject){timers.push({ns:timer.ns,res:getRes("us"),unit:"us"})}if(processObject&&typeof(timer.ns=processObject.hrtime)=="function"){timers.push({ns:timer.ns,res:getRes("ns"),unit:"ns"})}if(microtimeObject&&typeof(timer.ns=microtimeObject.now)=="function"){timers.push({ns:timer.ns,res:getRes("us"),unit:"us"})}timer=reduce(timers,function(timer,other){return other.res<timer.res?other:timer});if(timer.unit!="ns"&&applet){applet=destroyElement(applet)}if(timer.res==Infinity){throw new Error("Benchmark.js was unable to find a working timer.")}if(timer.unit=="ns"){if(timer.ns.nanoTime){extend(template,{begin:"s$=n$.nanoTime()",end:"r$=(n$.nanoTime()-s$)/1e9"})}else{extend(template,{begin:"s$=n$()",end:"r$=n$(s$);r$=r$[0]+(r$[1]/1e9)"})}}else if(timer.unit=="us"){if(timer.ns.stop){extend(template,{begin:"s$=n$.start()",end:"r$=n$.microseconds()/1e6"})}else if(perfName){extend(template,{begin:"s$=n$."+perfName+"()",end:"r$=(n$."+perfName+"()-s$)/1e3"})}else{extend(template,{begin:"s$=n$()",end:"r$=(n$()-s$)/1e6"})}}timer.start=createFunction(preprocess("o$"),preprocess("var n$=this.ns,#{begin};o$.elapsed=0;o$.timeStamp=s$"));timer.stop=createFunction(preprocess("o$"),preprocess("var n$=this.ns,s$=o$.timeStamp,#{end};o$.elapsed=r$"));options.minTime||(options.minTime=max(timer.res/2/.01,.05));return clock.apply(null,arguments)}function compute(bench,options){options||(options={});var async=options.async,elapsed=0,initCount=bench.initCount,minSamples=bench.minSamples,queue=[],sample=bench.stats.sample;function enqueue(){queue.push(bench.clone({_original:bench,events:{abort:[update],cycle:[update],error:[update],start:[update]}}))}function update(event){var clone=this,type=event.type;if(bench.running){if(type=="start"){clone.count=bench.initCount}else{if(type=="error"){bench.error=clone.error}if(type=="abort"){bench.abort();bench.emit("cycle")}else{event.currentTarget=event.target=bench;bench.emit(event)}}}else if(bench.aborted){clone.events.abort.length=0;clone.abort()}}function evaluate(event){var critical,df,mean,moe,rme,sd,sem,variance,clone=event.target,done=bench.aborted,now=+new Date,size=sample.push(clone.times.period),maxedOut=size>=minSamples&&(elapsed+=now-clone.times.timeStamp)/1e3>bench.maxTime,times=bench.times,varOf=function(sum,x){return sum+pow(x-mean,2)};if(done||clone.hz==Infinity){maxedOut=!(size=sample.length=queue.length=0)}if(!done){mean=getMean(sample);variance=reduce(sample,varOf,0)/(size-1)||0;sd=sqrt(variance);sem=sd/sqrt(size);df=size-1;critical=tTable[Math.round(df)||1]||tTable.infinity;moe=sem*critical;rme=moe/mean*100||0;extend(bench.stats,{deviation:sd,mean:mean,moe:moe,rme:rme,sem:sem,variance:variance});if(maxedOut){bench.initCount=initCount;bench.running=false;done=true;times.elapsed=(now-times.timeStamp)/1e3}if(bench.hz!=Infinity){bench.hz=1/mean;times.cycle=mean*bench.count;times.period=mean}}if(queue.length<2&&!maxedOut){enqueue()}event.aborted=done}enqueue();invoke(queue,{name:"run",args:{async:async},queued:true,onCycle:evaluate,onComplete:function(){bench.emit("complete")}})}function cycle(clone,options){options||(options={});var deferred;if(clone instanceof Deferred){deferred=clone;clone=clone.benchmark}var clocked,cycles,divisor,event,minTime,period,async=options.async,bench=clone._original,count=clone.count,times=clone.times;if(clone.running){cycles=++clone.cycles;clocked=deferred?deferred.elapsed:clock(clone);minTime=clone.minTime;if(cycles>bench.cycles){bench.cycles=cycles}if(clone.error){event=Event("error");event.message=clone.error;clone.emit(event);if(!event.cancelled){clone.abort()}}}if(clone.running){bench.times.cycle=times.cycle=clocked;period=bench.times.period=times.period=clocked/count;bench.hz=clone.hz=1/period;bench.initCount=clone.initCount=count;clone.running=clocked<minTime;if(clone.running){if(!clocked&&(divisor=divisors[clone.cycles])!=null){count=floor(4e6/divisor)}if(count<=clone.count){count+=Math.ceil((minTime-clocked)/period)}clone.running=count!=Infinity}}event=Event("cycle");clone.emit(event);if(event.aborted){clone.abort()}if(clone.running){clone.count=count;if(deferred){clone.compiled.call(deferred,timer)}else if(async){delay(clone,function(){cycle(clone,options)})}else{cycle(clone)}}else{if(support.browser){runScript(uid+"=1;delete "+uid)}clone.emit("complete")}}function run(options){var me=this,event=Event("start");me.running=false;me.reset();me.running=true;me.count=me.initCount;me.times.timeStamp=+new Date;me.emit(event);if(!event.cancelled){options={async:((options=options&&options.async)==null?me.async:options)&&support.timeout};if(me._original){if(me.defer){Deferred(me)}else{cycle(me,options)}}else{compute(me,options)}}return me}extend(Benchmark,{options:{async:false,defer:false,delay:.005,id:undefined,initCount:1,maxTime:5,minSamples:5,minTime:0,name:undefined,onAbort:undefined,onComplete:undefined,onCycle:undefined,onError:undefined,onReset:undefined,onStart:undefined},platform:req("platform")||window.platform||{description:window.navigator&&navigator.userAgent||null,layout:null,product:null,name:null,manufacturer:null,os:null,prerelease:null,version:null,toString:function(){return this.description||""}},version:"1.0.0",support:support,deepClone:deepClone,each:each,extend:extend,filter:filter,forEach:forEach,forOwn:forOwn,formatNumber:formatNumber,hasKey:(hasKey(Benchmark,""),hasKey),indexOf:indexOf,interpolate:interpolate,invoke:invoke,join:join,map:map,pluck:pluck,reduce:reduce});extend(Benchmark.prototype,{count:0,cycles:0,hz:0,compiled:undefined,error:undefined,fn:undefined,aborted:false,running:false,setup:noop,teardown:noop,stats:{moe:0,rme:0,sem:0,deviation:0,mean:0,sample:[],variance:0},times:{cycle:0,elapsed:0,period:0,timeStamp:0},abort:abort,clone:clone,compare:compare,emit:emit,listeners:listeners,off:off,on:on,reset:reset,run:run,toString:toStringBench});extend(Deferred.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0,resolve:resolve});extend(Event.prototype,{aborted:false,cancelled:false,currentTarget:undefined,result:undefined,target:undefined,timeStamp:0,type:""});Suite.options={name:undefined};extend(Suite.prototype,{length:0,aborted:false,running:false,forEach:methodize(forEach),indexOf:methodize(indexOf),invoke:methodize(invoke),join:[].join,map:methodize(map),pluck:methodize(pluck),pop:[].pop,push:[].push,sort:[].sort,reduce:methodize(reduce),abort:abortSuite,add:add,clone:cloneSuite,emit:emit,filter:filterSuite,listeners:listeners,off:off,on:on,reset:resetSuite,run:runSuite,concat:concat,reverse:reverse,shift:shift,slice:slice,splice:splice,unshift:unshift});extend(Benchmark,{Deferred:Deferred,Event:Event,Suite:Suite});if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define(function(){return Benchmark})}else if(freeExports){if(typeof module=="object"&&module&&module.exports==freeExports){(module.exports=Benchmark).Benchmark=Benchmark}else{freeExports.Benchmark=Benchmark}}else{window["Benchmark"]=Benchmark}if(support.air){clock({_original:{fn:noop,count:1,options:{}}})}})(this)}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{_process:1}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],2:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canMutationObserver=typeof window!=="undefined"&&window.MutationObserver;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}var queue=[];if(canMutationObserver){var hiddenDiv=document.createElement("div");var observer=new MutationObserver(function(){var queueList=queue.slice();queue.length=0;queueList.forEach(function(fn){fn()})});observer.observe(hiddenDiv,{attributes:true});return function nextTick(fn){if(!queue.length){hiddenDiv.setAttribute("yes","no")}queue.push(fn)}}if(canPost){window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],3:[function(require,module,exports){module.exports=function isBuffer(arg){return arg&&typeof arg==="object"&&typeof arg.copy==="function"&&typeof arg.fill==="function"&&typeof arg.readUInt8==="function"}},{}],4:[function(require,module,exports){(function(process,global){var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++){objects.push(inspect(arguments[i]))}return objects.join(" ")}var i=1;var args=arguments;var len=args.length;var str=String(f).replace(formatRegExp,function(x){if(x==="%%")return"%";if(i>=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}});for(var x=args[i];i<len;x=args[++i]){if(isNull(x)||!isObject(x)){str+=" "+x}else{str+=" "+inspect(x)}}return str};exports.deprecate=function(fn,msg){if(isUndefined(global.process)){return function(){return exports.deprecate(fn,msg).apply(this,arguments)}}if(process.noDeprecation===true){return fn}var warned=false;function deprecated(){if(!warned){if(process.throwDeprecation){throw new Error(msg)}else if(process.traceDeprecation){console.trace(msg)}else{console.error(msg)}warned=true}return fn.apply(this,arguments)}return deprecated};var debugs={};var debugEnviron;exports.debuglog=function(set){if(isUndefined(debugEnviron))debugEnviron=process.env.NODE_DEBUG||"";set=set.toUpperCase();if(!debugs[set]){if(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid,msg)}}else{debugs[set]=function(){}}}return debugs[set]};function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){ctx.showHidden=opts}else if(opts){exports._extend(ctx,opts)}if(isUndefined(ctx.showHidden))ctx.showHidden=false;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=false;if(isUndefined(ctx.customInspect))ctx.customInspect=true;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}exports.inspect=inspect;inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};inspect.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m"}else{return str}}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};array.forEach(function(val,idx){hash[val]=true});return hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret)){ret=formatValue(ctx,ret,recurseTimes)}return ret}var primitive=formatPrimitive(ctx,value);if(primitive){return primitive}var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value)}if(isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0)){return formatError(value)}if(keys.length===0){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}if(isDate(value)){return ctx.stylize(Date.prototype.toString.call(value),"date")}if(isError(value)){return formatError(value)}}var base="",array=false,braces=["{","}"];if(isArray(value)){array=true;braces=["[","]"]}if(isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)){base=" "+RegExp.prototype.toString.call(value)}if(isDate(value)){base=" "+Date.prototype.toUTCString.call(value)}if(isError(value)){base=" "+formatError(value)}if(keys.length===0&&(!array||value.length==0)){return braces[0]+base+braces[1]}if(recurseTimes<0){if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}else{return ctx.stylize("[Object]","special")}}ctx.seen.push(value);var output;if(array){output=formatArray(ctx,value,recurseTimes,visibleKeys,keys)}else{output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)})}ctx.seen.pop();return reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i){if(hasOwnProperty(value,String(i))){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),true))}else{output.push("")}}keys.forEach(function(key){if(!key.match(/^\d+$/)){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,true))}});return output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]};if(desc.get){if(desc.set){str=ctx.stylize("[Getter/Setter]","special")}else{str=ctx.stylize("[Getter]","special")}}else{if(desc.set){str=ctx.stylize("[Setter]","special")}}if(!hasOwnProperty(visibleKeys,key)){name="["+key+"]"}if(!str){if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes)){str=formatValue(ctx,desc.value,null)}else{str=formatValue(ctx,desc.value,recurseTimes-1)}if(str.indexOf("\n")>-1){if(array){str=str.split("\n").map(function(line){return" "+line}).join("\n").substr(2)}else{str="\n"+str.split("\n").map(function(line){return" "+line}).join("\n")}}}else{str=ctx.stylize("[Circular]","special")}}if(isUndefined(name)){if(array&&key.match(/^\d+$/)){return str}name=JSON.stringify(""+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=ctx.stylize(name,"name")}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=ctx.stylize(name,"string")}}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;var length=output.reduce(function(prev,cur){numLinesEst++;if(cur.indexOf("\n")>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60){return braces[0]+(base===""?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]}return braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=require("./support/isBuffer");function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var d=new Date;var time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))};exports.inherits=require("inherits");exports._extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":3,_process:2,inherits:1}],assert:[function(require,module,exports){var util=require("util/");var pSlice=Array.prototype.slice;var hasOwn=Object.prototype.hasOwnProperty;var assert=module.exports=ok;assert.AssertionError=function AssertionError(options){this.name="AssertionError";this.actual=options.actual;this.expected=options.expected;this.operator=options.operator;if(options.message){this.message=options.message;this.generatedMessage=false}else{this.message=getMessage(this);this.generatedMessage=true}var stackStartFunction=options.stackStartFunction||fail;if(Error.captureStackTrace){Error.captureStackTrace(this,stackStartFunction)}else{var err=new Error;if(err.stack){var out=err.stack;var fn_name=stackStartFunction.name;var idx=out.indexOf("\n"+fn_name);if(idx>=0){var next_line=out.indexOf("\n",idx+1);out=out.substring(next_line+1)}this.stack=out}}};util.inherits(assert.AssertionError,Error);function replacer(key,value){if(util.isUndefined(value)){return""+value}if(util.isNumber(value)&&(isNaN(value)||!isFinite(value))){return value.toString()}if(util.isFunction(value)||util.isRegExp(value)){return value.toString()}return value}function truncate(s,n){if(util.isString(s)){return s.length<n?s:s.slice(0,n)}else{return s}}function getMessage(self){return truncate(JSON.stringify(self.actual,replacer),128)+" "+self.operator+" "+truncate(JSON.stringify(self.expected,replacer),128)}function fail(actual,expected,message,operator,stackStartFunction){throw new assert.AssertionError({message:message,actual:actual,expected:expected,operator:operator,stackStartFunction:stackStartFunction})}assert.fail=fail;function ok(value,message){if(!value)fail(value,true,message,"==",assert.ok)}assert.ok=ok;assert.equal=function equal(actual,expected,message){if(actual!=expected)fail(actual,expected,message,"==",assert.equal)};assert.notEqual=function notEqual(actual,expected,message){if(actual==expected){fail(actual,expected,message,"!=",assert.notEqual)}};assert.deepEqual=function deepEqual(actual,expected,message){if(!_deepEqual(actual,expected)){fail(actual,expected,message,"deepEqual",assert.deepEqual)}};function _deepEqual(actual,expected){if(actual===expected){return true}else if(util.isBuffer(actual)&&util.isBuffer(expected)){if(actual.length!=expected.length)return false;for(var i=0;i<actual.length;i++){if(actual[i]!==expected[i])return false}return true}else if(util.isDate(actual)&&util.isDate(expected)){return actual.getTime()===expected.getTime()}else if(util.isRegExp(actual)&&util.isRegExp(expected)){return actual.source===expected.source&&actual.global===expected.global&&actual.multiline===expected.multiline&&actual.lastIndex===expected.lastIndex&&actual.ignoreCase===expected.ignoreCase}else if(!util.isObject(actual)&&!util.isObject(expected)){return actual==expected}else{return objEquiv(actual,expected)}}function isArguments(object){return Object.prototype.toString.call(object)=="[object Arguments]"}function objEquiv(a,b){if(util.isNullOrUndefined(a)||util.isNullOrUndefined(b))return false;if(a.prototype!==b.prototype)return false;if(isArguments(a)){if(!isArguments(b)){return false}a=pSlice.call(a);b=pSlice.call(b);return _deepEqual(a,b)}try{var ka=objectKeys(a),kb=objectKeys(b),key,i}catch(e){return false}if(ka.length!=kb.length)return false;ka.sort();kb.sort();for(i=ka.length-1;i>=0;i--){if(ka[i]!=kb[i])return false}for(i=ka.length-1;i>=0;i--){key=ka[i];if(!_deepEqual(a[key],b[key]))return false}return true}assert.notDeepEqual=function notDeepEqual(actual,expected,message){if(_deepEqual(actual,expected)){fail(actual,expected,message,"notDeepEqual",assert.notDeepEqual)}};assert.strictEqual=function strictEqual(actual,expected,message){if(actual!==expected){fail(actual,expected,message,"===",assert.strictEqual)}};assert.notStrictEqual=function notStrictEqual(actual,expected,message){if(actual===expected){fail(actual,expected,message,"!==",assert.notStrictEqual)}};function expectedException(actual,expected){if(!actual||!expected){return false}if(Object.prototype.toString.call(expected)=="[object RegExp]"){return expected.test(actual)}else if(actual instanceof expected){return true}else if(expected.call({},actual)===true){return true}return false}function _throws(shouldThrow,block,expected,message){var actual;if(util.isString(expected)){message=expected;expected=null}try{block()}catch(e){actual=e}message=(expected&&expected.name?" ("+expected.name+").":".")+(message?" "+message:".");if(shouldThrow&&!actual){fail(actual,expected,"Missing expected exception"+message)}if(!shouldThrow&&expectedException(actual,expected)){fail(actual,expected,"Got unwanted exception"+message)}if(shouldThrow&&actual&&expected&&!expectedException(actual,expected)||!shouldThrow&&actual){throw actual}}assert.throws=function(block,error,message){_throws.apply(this,[true].concat(pSlice.call(arguments)))};assert.doesNotThrow=function(block,message){_throws.apply(this,[false].concat(pSlice.call(arguments)))};assert.ifError=function(err){if(err){throw err}};var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj){if(hasOwn.call(obj,key))keys.push(key)}return keys}},{"util/":4}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var indexOf=require("./indexOf");function contains(arr,val){return indexOf(arr,val)!==-1}module.exports=contains},{"./indexOf":3}],2:[function(require,module,exports){var makeIterator=require("../function/makeIterator_");function filter(arr,callback,thisObj){callback=makeIterator(callback,thisObj);var results=[];if(arr==null){return results}var i=-1,len=arr.length,value;while(++i<len){value=arr[i];if(callback(value,i,arr)){results.push(value)}}return results}module.exports=filter},{"../function/makeIterator_":8}],3:[function(require,module,exports){function indexOf(arr,item,fromIndex){fromIndex=fromIndex||0;if(arr==null){return-1}var len=arr.length,i=fromIndex<0?len+fromIndex:fromIndex;while(i<len){if(arr[i]===item){return i}i++}return-1}module.exports=indexOf},{}],4:[function(require,module,exports){function slice(arr,start,end){var len=arr.length;if(start==null){start=0}else if(start<0){start=Math.max(len+start,0)}else{start=Math.min(start,len)}if(end==null){end=len}else if(end<0){end=Math.max(len+end,0)}else{end=Math.min(end,len)}var result=[];while(start<end){result.push(arr[start++])}return result}module.exports=slice},{}],5:[function(require,module,exports){var makeIterator=require("../function/makeIterator_");function some(arr,callback,thisObj){callback=makeIterator(callback,thisObj);var result=false;if(arr==null){return result}var i=-1,len=arr.length;while(++i<len){if(callback(arr[i],i,arr)){result=true;break}}return result}module.exports=some},{"../function/makeIterator_":8}],6:[function(require,module,exports){var filter=require("./filter");function unique(arr,compare){compare=compare||isEqual;return filter(arr,function(item,i,arr){var n=arr.length;while(++i<n){if(compare(item,arr[i])){return false}}return true})}function isEqual(a,b){return a===b}module.exports=unique},{"./filter":2}],7:[function(require,module,exports){function identity(val){return val}module.exports=identity},{}],8:[function(require,module,exports){var identity=require("./identity");var prop=require("./prop");var deepMatches=require("../object/deepMatches");function makeIterator(src,thisObj){if(src==null){return identity}switch(typeof src){case"function":return typeof thisObj!=="undefined"?function(val,i,arr){return src.call(thisObj,val,i,arr)}:src;case"object":return function(val){return deepMatches(val,src)};case"string":case"number":return prop(src)}}module.exports=makeIterator},{"../object/deepMatches":13,"./identity":7,"./prop":9}],9:[function(require,module,exports){function prop(name){return function(obj){return obj[name]}}module.exports=prop},{}],10:[function(require,module,exports){var isKind=require("./isKind");var isArray=Array.isArray||function(val){return isKind(val,"Array")};module.exports=isArray},{"./isKind":11}],11:[function(require,module,exports){var kindOf=require("./kindOf");function isKind(val,kind){return kindOf(val)===kind}module.exports=isKind},{"./kindOf":12}],12:[function(require,module,exports){var _rKind=/^\[object (.*)\]$/,_toString=Object.prototype.toString,UNDEF;function kindOf(val){if(val===null){return"Null"}else if(val===UNDEF){return"Undefined"}else{return _rKind.exec(_toString.call(val))[1]}}module.exports=kindOf},{}],13:[function(require,module,exports){var forOwn=require("./forOwn");var isArray=require("../lang/isArray");function containsMatch(array,pattern){var i=-1,length=array.length;while(++i<length){if(deepMatches(array[i],pattern)){return true}}return false}function matchArray(target,pattern){var i=-1,patternLength=pattern.length;while(++i<patternLength){if(!containsMatch(target,pattern[i])){return false}}return true}function matchObject(target,pattern){var result=true;forOwn(pattern,function(val,key){if(!deepMatches(target[key],val)){return result=false}});return result}function deepMatches(target,pattern){if(target&&typeof target==="object"){if(isArray(target)&&isArray(pattern)){return matchArray(target,pattern)}else{return matchObject(target,pattern)}}else{return target===pattern}}module.exports=deepMatches},{"../lang/isArray":10,"./forOwn":15}],14:[function(require,module,exports){var hasOwn=require("./hasOwn");var _hasDontEnumBug,_dontEnums;function checkDontEnum(){_dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];_hasDontEnumBug=true;for(var key in{toString:null}){_hasDontEnumBug=false}}function forIn(obj,fn,thisObj){var key,i=0;if(_hasDontEnumBug==null)checkDontEnum();for(key in obj){if(exec(fn,obj,key,thisObj)===false){break}}if(_hasDontEnumBug){var ctor=obj.constructor,isProto=!!ctor&&obj===ctor.prototype;while(key=_dontEnums[i++]){if((key!=="constructor"||!isProto&&hasOwn(obj,key))&&obj[key]!==Object.prototype[key]){if(exec(fn,obj,key,thisObj)===false){break}}}}}function exec(fn,obj,key,thisObj){return fn.call(thisObj,obj[key],key,obj)}module.exports=forIn},{"./hasOwn":16}],15:[function(require,module,exports){var hasOwn=require("./hasOwn");var forIn=require("./forIn");function forOwn(obj,fn,thisObj){forIn(obj,function(val,key){if(hasOwn(obj,key)){return fn.call(thisObj,obj[key],key,obj)}})}module.exports=forOwn},{"./forIn":14,"./hasOwn":16}],16:[function(require,module,exports){function hasOwn(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}module.exports=hasOwn},{}],"mout/array/difference":[function(require,module,exports){var unique=require("./unique");var filter=require("./filter");var some=require("./some");var contains=require("./contains");var slice=require("./slice");function difference(arr){var arrs=slice(arguments,1),result=filter(unique(arr),function(needle){return!some(arrs,function(haystack){return contains(haystack,needle)})});return result}module.exports=difference},{"./contains":1,"./filter":2,"./slice":4,"./some":5,"./unique":6}]},{},[]);var Benchmark=require("benchmark");var suite=new Benchmark.Suite;global.moutdifference=require("mout/array/difference");global.assert=require("assert");function setup(){destArr=[];var worstCaseArr1=[];var worstCaseArr2=[];for(var i=0;i<50;i++){worstCaseArr1.push("prop1_"+i);worstCaseArr2.push("prop2_"+i)}function diffN(out,a,b,n){if(a!==out)out.push.apply(out,a);for(var i=2;i<arguments.length;i++){var arr=arguments[i];for(var k=0;k<arr.length;k++){var idx=out.indexOf(arr[k]);if(idx!==-1){out.splice(idx,1)}}}return out}function diff2(out,a,b){if(a!==out)out.push.apply(out,a);var arr=b;for(var k=0;k<b.length;k++){var idx=out.indexOf(b[k]);if(idx!==-1){out.splice(idx,1)}}return out}}function reset(){destArr.length=0}var bopts={setup:setup,start:reset,cycle:reset,teardown:reset};suite.add("mout/array/difference",function(){destArr.length=0;var d=moutdifference(worstCaseArr1,worstCaseArr2);assert(d[0],"prop1_0")},bopts).add("diffN with new array",function(){destArr.length=0;var d=diffN([],worstCaseArr1,worstCaseArr2); | |
assert(d[0],"prop1_0")},bopts).add("diffN with existing array",function(){destArr.length=0;var d=diffN(destArr,worstCaseArr1,worstCaseArr2);assert(d[0],"prop1_0")},bopts).add("diff2 with new array",function(){destArr.length=0;var d=diff2([],worstCaseArr1,worstCaseArr2);assert(d[0],"prop1_0")},bopts).add("diff2 with existing array",function(){destArr.length=0;var d=diff2(destArr,worstCaseArr1,worstCaseArr2);assert(d[0],"prop1_0")},bopts).add("manual loop with new array",function(){destArr.length=0;var out=[];out.push.apply(out,worstCaseArr1);for(var i=0,len=worstCaseArr2.length;i<len;i++){var found=out.indexOf(worstCaseArr2[i]);if(found>-1){out.splice(found,1)}}},bopts).add("manual loop with existing array",function(){destArr.length=0;var out=destArr;out.push.apply(out,worstCaseArr1);for(var i=0,len=worstCaseArr2.length;i<len;i++){var found=out.indexOf(worstCaseArr2[i]);if(found>-1){out.splice(found,1)}}},bopts).on("cycle",function(event){console.log(String(event.target))}).on("complete",function(){console.log("Fastest is "+this.filter("fastest").pluck("name"))}).on("error",console.error.bind(console)).run({async:false}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"benchmark": "1.0.0", | |
"mout": "0.11.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- contents of this file will be placed inside the <body> --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- contents of this file will be placed inside the <head> --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment