Created
January 7, 2017 16:25
-
-
Save cevek/fb0213f7bfb9ea4a583e1f2500c35cf9 to your computer and use it in GitHub Desktop.
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]; | |
var arrX6 = [1,2,3, "", true, null, {}, 20, 40, 50, 60]; | |
var arrY6 = [4,5,6, false, "", {}]; | |
var x1 = {a: 2, cb: 3, d: 3, type: 1}; | |
var y1 = {a1: 2, cb1: 3, d1: 3, type: 2, k: 323}; | |
var x2 = {a65: 2, cb34: 3, d: 3, type: 1}; | |
var y2 = {a2: 2, cb2: 3, d2: 3, type: 2, k4: 323}; | |
var x3 = {a43: 2, cb: 3, d65: 3, type: 1}; | |
var y3 = {a3: 2, cb3: 3, d3: 3, type: 2, k5: 323}; | |
var x4 = {a66: 2, cb1: 3, dy: 3, type: 1}; | |
var y4 = {a4: 2, cb4: 3, d4: 3, type: 2, k7: 323}; | |
var x5 = {a665: 2, cb761: 3, d7y: 3, type: 1}; | |
var y5 = {a764: 2, cb467: 3, d47: 3, type: 2, k67: 323}; | |
function abc() { | |
console.time('perf'); | |
for (let i = 0; i < 1e7; i++) { | |
readArr(arrX1, arrY1); | |
readArr(arrX2, arrY2); | |
readArr(arrX3, arrY3); | |
readArr(arrX4, arrY4); | |
readArr(arrX5, arrY5); | |
// readObj(x1, y1); | |
// readObj(x2, y2); | |
// readObj(x3, y3); | |
// readObj(x4, y4); | |
// readObj(x5, y5); | |
} | |
console.timeEnd('perf'); | |
} | |
function readArr(arr, arr2) { | |
if (arr[2] === arr2[2]) { | |
return 123; | |
} | |
return 43; | |
} | |
function readObj(o1, o2) { | |
if (o1.type === o2.type) { | |
return 123; | |
} | |
return 43; | |
} | |
abc(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment