Created
October 20, 2010 19:35
-
-
Save stagas/637138 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 self = this | |
, c = 0 | |
, dels = [] | |
, o | |
, k | |
, tim = new Date() | |
var free = function() { | |
var t = new Date() | |
if (t - tim > 10000) { | |
while (ok = dels.pop()) { | |
delete self[ok[0]][ok[1]] | |
} | |
tim = t | |
} | |
} | |
var next = function() { | |
o = Math.floor(Math.random() * 16).toString() | |
+ Math.floor(Math.random() * 16).toString() | |
if (typeof self[o] === 'undefined') self[o] = {} | |
k = Math.floor(Math.random() * 10000000000).toString() | |
self[o][k] = ['3523', '2347'] | |
c++ | |
if (c % 10000 === 0) console.log(c) | |
dels.push([o,k]) | |
process.nextTick(function() { | |
free() | |
next() | |
}) | |
} | |
next() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment