Last active
December 15, 2015 21:50
-
-
Save zootella/5329014 to your computer and use it in GitHub Desktop.
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 start = new Date(); | |
// ---- | |
var size = 10000; | |
var a = []; | |
for (var i = 0; i < size; i++) { | |
a.push(i); | |
} | |
while (a.length) { | |
var r = Math.floor(a.length / 2); | |
a.splice(r, 1); | |
} | |
// ---- | |
var end = new Date(); | |
console.log("Operation took " + (end.getTime() - start.getTime()) + "ms"); | |
// ---- | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment