Created
October 11, 2014 17:25
-
-
Save bttmly/c934404e96cfd3af6569 to your computer and use it in GitHub Desktop.
poser push benchmark
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 grabIt (thing) { | |
var frame = document.createElement('iframe'); | |
document.body.appendChild(frame); | |
var thing = frame.contentWindow[thing]; | |
document.body.removeChild(frame); | |
return thing; | |
} | |
var Collection = grabIt("Array"); | |
var c = new Collection(); | |
var a = new Array(); | |
function push1000 (arr) { | |
var i = -1; | |
while (++i < 1000) { | |
arr.push(i); | |
} | |
} | |
console.time('col'); | |
push1000(c); | |
console.timeEnd('col'); | |
console.time('arr'); | |
push1000(a); | |
console.timeEnd('arr'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment