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
/* tnx @kangax for idea */ | |
var i, n = 400000, | |
_fn = function(){}, that = {}, args = []; | |
console.time("call"); | |
i = n; while(i--) | |
{ | |
_fn.call(that); | |
} |
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 | |
parseAcceptRE = new RegExp(/[{}\[\]:,]+|\"([^\\\"]*?\\.)*[^\"]*?\"|[+\-]?\d+(?:\.\d+)?(?:[eE][+\-]?\d+)?|true|false|null|\s+/g), | |
// var name at begin | |
// keywords, which can be written space separeted | |
// specific keywords | |
// operator and var name or object | |
// property access (but not number point delimiter) | |
// property access via square bracket (but not array declaration) | |
unsafeCharsRE = new RegExp(/^[a-zA-Z_\$\/]|var|new|instanceof|var|function|typeof|(?![\[,:]\[)[\+\-\*\/%\^&\|~\!\=<>\:,\[\(]\s*[a-zA-Z_\$\/\[]|\.[a-zA-Z_\$]|[\w\$\/\)\]]\s*\[/); |
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 i,n=1000000; | |
var a="123"; | |
var b=Object(a); | |
console.time("Primitive.charAt"); | |
i=n; | |
while(i--) | |
a.charAt(0); | |
console.timeEnd("Primitive.charAt"); |
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 _nodeUnique = function (nodeArray) { | |
var a = -1, len = nodeArray.length, b = -1, ret = new Array(); | |
while (++a < len) { | |
while (++b < len && nodeArray[b] === nodeArray[a]) | |
; | |
ret[b] = nodeArray[a]; | |
} |
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 _nodeUnique = function (nodeArray) | |
{ | |
var len = nodeArray.length, i = 0; | |
while (i < len && nodeArray[i] !== nodeArray[++i]) | |
; | |
if(i >= len) | |
return nodeArray; | |
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 _propertyNameSanitize = (function() | |
{ | |
var re = new RegExp(/-([a-z])/g); | |
var _replacer = function (str, cap) { | |
return cap.toUpperCase(); | |
}; | |
return function (propertyName) { | |
return propertyName.replace(re, _replacer); | |
}; |
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
if(!console) | |
console = {}; | |
if(!console.log) | |
console.log = $jb._log; | |
console.time = $jb._timerBegin; | |
console.timeEnd = $jb._timerEnd; | |
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
if(!console.log) | |
console.log = $jb._log; | |
console.time = $jb._timerBegin; | |
console.timeEnd = $jb._timerEnd; | |
var i, n = 40000, | |
a = '11111111111111111111111111111111'; | |
console.time("1"); |
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
(function() | |
{ | |
var _oldBind = Function.prototype.bind, _slice = Array.prototype.slice, | |
_toString = function() | |
{ | |
return '' + this._fn; | |
}; | |
Function.prototype.bind = function(that) | |
{ |
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
#include <stdio.h> | |
#include <stdlib.h> | |
typedef int uint; | |
uint _sha1(uint * xs, uint len) | |
{ | |
uint v85,v84,v83,v82,v81,v80,v79,v78,v77,v76,v75,v74,v73,v72,v71,v70,v69,v68,v67,v66,v65,v64,v63,v62,v61,v60,v59,v58,v57,v56,v55,v54,v53,v52,v51,v50,v49,v48,v47,v46,v45,v44,v43,v42,v41,v40,v39,v38,v37,v36,v35,v34,v33,v32,v31,v30,v29,v28,v27,v26,v25,v24,v23,v22,v21,v20,v19,v18,v17,v16,v15,v14,v13,v12,v11,v10,v9,v8,v7,v6,v5,v4,v3,v2,v1,v0; | |