This file contains hidden or 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
// Utf8 parse performance: 1000 * 140kb ~ 140mb | |
// UTF8ToUTF16: 520ms | |
// Buffer.toString: 510ms | |
// Convert utf16 to utf8 performance: 1000 * 125k length | |
// UTF16ToUTF8: 420ms | |
// Buffer.toString: 1000ms | |
function UTF8ToUTF16(arr) { | |
var arrBuff = new ArrayBuffer(arr.length * 2); |
This file contains hidden or 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 fs = require('fs'); | |
var js = fs.readFileSync('small.js', 'utf-8'); | |
// performance: | |
// 10mb of code - 50ms | |
function find(js) { | |
var skipBlocks = []; | |
var k = 0; | |
js = js + '\n'; |
This file contains hidden or 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
// results: new P, new P ~160ms | |
// results: new P, new PP ~190ms | |
// results: new PP, new PP ~210ms | |
function P() { | |
} | |
P.prototype.then = function (fn, arg) { | |
fn(); |
This file contains hidden or 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 arrX1 = [1,2,3, "", true, null, {}, 20, 40, 50, 60]; | |
var arrY1 = [4,5,6, {}, 123, Object, 43, ",", void 0, null]; | |
var arrX2 = [1,2,3, "", true, null, {}, 20, 40, 50, 60]; | |
var arrY2 = [4,5,6, 234, {}, {}, Object, 43, ",", void 0, null]; | |
var arrX3 = [1,2,3, {}, 20, 40, 50, 60]; | |
var arrY3 = [4,5,6]; | |
var arrX4 = [1,2,3, "", true, 23, null, {}]; | |
var arrY4 = [4,5,6, false]; | |
var arrX5 = [1,2,3, 123, "", true, null, {}, 20]; | |
var arrY5 = [4,5,6, false, "", {}, Object]; |
This file contains hidden or 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 hash100 = {"x0":true,"x1":true,"x2":true,"x3":true,"x4":true,"x5":true,"x6":true,"x7":true,"x8":true,"x9":true,"x10":true,"x11":true,"x12":true,"x13":true,"x14":true,"x15":true,"x16":true,"x17":true,"x18":true,"x19":true,"x20":true,"x21":true,"x22":true,"x23":true,"x24":true,"x25":true,"x26":true,"x27":true,"x28":true,"x29":true,"x30":true,"x31":true,"x32":true,"x33":true,"x34":true,"x35":true,"x36":true,"x37":true,"x38":true,"x39":true,"x40":true,"x41":true,"x42":true,"x43":true,"x44":true,"x45":true,"x46":true,"x47":true,"x48":true,"x49":true,"x50":true,"x51":true,"x52":true,"x53":true,"x54":true,"x55":true,"x56":true,"x57":true,"x58":true,"x59":true,"x60":true,"x61":true,"x62":true,"x63":true,"x64":true,"x65":true,"x66":true,"x67":true,"x68":true,"x69":true,"x70":true,"x71":true,"x72":true,"x73":true,"x74":true,"x75":true,"x76":true,"x77":true,"x78":true,"x79":true,"x80":true,"x81":true,"x82":true,"x83":true,"x84":true,"x85":true,"x86":true,"x87":true,"x88":true,"x89":true,"x90":true,"x91":true,"x92":t |
This file contains hidden or 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 forIn(obj) { | |
// for(var i in obj){break;} | |
for (var key in obj) { | |
var val = obj[key]; | |
// console.log(key, val); | |
} | |
} | |
function removeProp(key){ | |
node.style[key] = null; |
This file contains hidden or 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 hash() { | |
var obj = {}; | |
setHash(obj, 16); | |
setHash(obj, 4); | |
setHash(obj, 9); | |
setHash(obj, 53); | |
setHash(obj, 14); | |
} | |
function setHash(obj, id) { |
This file contains hidden or 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 strings = ["eqwed", "cfjnf", "ekttp", "dghnc", "wcdkt", "quwuj", "almt", "beijl", "tjdku", "gfpit", "frpap", "mrrbo", "hquup", "tlvb", "ciubn", "qamk", "bohgl", "ufpti", "omelp", "vssmj", "repvs", "gwgbp", "ltwog", "lpcnh", "nngsq", "ejkke", "uvohi", "rshow", "rkmvo", "suffs", "dncla", "nmewm", "ccepr", "ggura", "ssjct", "ndfwb", "trjof", "risin", "baqlf", "ari", "lubqt", "atlue", "atrgo", "wrnsn", "quwrf", "fvkse", "norah", "cuora", "dawng", "ueowi", "abidd", "svif", "salbk", "sdhkt", "ewpoe", "rth", "uqbwk", "qtvnc", "obevu", "cadjr", "wvqub", "oemji", "gnoak", "lqhpb", "esndj", "vwbgm", "thhql", "gwdsu", "raleg", "wmofv", "dinmj", "evjtt", "bjisl", "lmbrn", "pglqh", "uvbbi", "rocbg", "ltgmr", "umqwv", "iidcm", "plcie", "hqlww", "somtl", "gldng", "cwmgh", "mhve", "vjrru", "lcvjp", "mjfff", "nohwu", "bjqoi", "wftgf", "atgn", "gl", "pmuiq", "fjqka", "swdpi", "hmt", "vgmju", "mko", "img", "ocdeb", "ihglv", "niiug", "mbeeu", "rrwsh", "scdvj", "ofpsj", "qlkdn", "habkd", "jbonc", "mdmrc", "sqiro", "rmhn", "sh |
This file contains hidden or 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 str = ["d2rqw3","q5mkv6","68heu9","jbc8tc","we72sf","ch1tri","pjtnql","p5mohp","3ipjbo","evse5n","qbv8wn","4p13qm","g53vkl","ri6qek","5v9l8j","hbcg2i","sofath","74i5ng","ihl0hf","tunsbe","8aqn5d","jnthwd","v3wcqc","9h27kb","ku52ea","wa7u89","anap28","m3djt7","0ggen6","btj9h5","n9m4b4","1mow53","d2rqw3","ofulq2","2t0gk1","e93be0","pm667w","42911v","ffbssu","qsenmt","58higs","glkdar","s1n84r","6eq2vq","hrsupp","t7vpjo","7l1kdn","j14f7m","ue7a1l","8ra4sk","k7cwmj","vkfrgi","a0imah","ldlh4h","wqobvg","b6r6pf","mju1je","0wwtdd","cd2o7c","nq5j1b","268dsa","djb8m9","owe3g8","3cgva7","epjq47","q5mkv6","4ipfp5","fvsaj4","rbv5d3","5p1072","h53s11","si6ms0","6v9hlw","ibccfv","tof79v","84i23u","jhktut","uunoos","9aqjir","kntecq","w3w96p","ah240o","lu4vrn","0a7qlm","bnalfl","n3dg9l","1ggb3k","ctj5uj","o9m0oi","2mosih","e2rncg","pfui6f","3t0d0e","f937rd","qm62lc","528ufb","gfbp9b","rsek3a","68heu9","hlk9o8"]; | |
var hash = {}; | |
for (let i = 0; i < str.length; i++) { | |
hash[str[i]] = i; | |
} | |
function getHash(hash, prop) { | |
This file contains hidden or 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
https://github.com/v8/v8/tree/master/src/runtime | |
FinishArrayPrototypeSetup | |
SpecialArrayFunctions | |
FixedArrayGet | |
FixedArraySet | |
TransitionElementsKind | |
RemoveArrayHoles | |
MoveArrayContents | |
EstimateNumberOfElements |