Created
February 23, 2013 18:06
-
-
Save eendeego/5020702 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
#!/usr/bin/env node --trace_gc | |
# See also "Timers" in | |
# http://coding.smashingmagazine.com/2012/11/05/writing-fast-memory-efficient-javascript/ | |
'use strict'; | |
process.on('uncaughtException', function (err) { | |
console.log('Caught exception: ' + err); | |
}); | |
var counter = 0; | |
var wat = 0; | |
function incCounter(i) { | |
wat += i; | |
return ++counter; | |
} | |
for (var j=0; j < 10000; j++) { | |
for (var i=0; i < 10000; i++) { | |
var func = "function x_" + i + " () { return incCounter(" + i + "); };x_" + i + "();"; | |
eval(func); | |
} | |
console.log('Counter value: %s', counter); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment