Created
June 5, 2013 00:05
-
-
Save timrwood/5710669 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
(function () { | |
function Server(){ | |
this.clients = []; | |
} | |
Server.prototype.spawn = function () { | |
var i; | |
for (i = 0; i < 100000; i++) { | |
this.clients.push(new Client(this)); | |
} | |
} | |
Server.prototype.dump = function () { | |
this.clients = []; | |
} | |
Server.prototype.dump = function () { | |
while (this.clients.length) { | |
this.clients.pop().server = null; | |
} | |
} | |
function Client(server) { | |
this.server = server; | |
} | |
var server = new Server(); | |
setTimeout(function () { | |
server.spawn(); | |
}, 1000); | |
setTimeout(function () { | |
server.dump(); | |
}, 2000); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment