Created
August 2, 2017 12:59
-
-
Save mcollina/9eb14178619460789f9db20e06ed759c 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 max = 100000000 | |
console.time('empty loop') | |
function loop () { | |
for (var i = 0; i < max; i++) {} | |
} | |
loop() | |
console.timeEnd('empty loop') | |
console.time('literal') | |
var obj = null | |
function literal () { | |
for (var i = 0; i < max; i++) { | |
obj = { i } | |
} | |
} | |
literal() | |
console.timeEnd('literal') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment