Created
April 7, 2011 22:08
-
-
Save xk/908866 to your computer and use it in GitHub Desktop.
from main.js it works fine... (?)
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 str = ''; | |
var n= 1024*1024; | |
var i = n; | |
while (i--) str += "C"; | |
console.log('str.length -> ' + str.length); | |
var maxT= -1; | |
var save= []; | |
(function loop () { | |
var t0= Date.now(); | |
var buf = new Buffer(n); | |
buf.write(str, 0, 'utf8'); | |
t0= Date.now() - t0; | |
if (t0 > maxT) console.log("max time -> " + (maxT= t0) + 'ms'); | |
if (save.push(buf) > 100) save.length= 0; | |
process.nextTick(loop); | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment