Skip to content

Instantly share code, notes, and snippets.

@xk
Created April 7, 2011 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xk/908866 to your computer and use it in GitHub Desktop.
Save xk/908866 to your computer and use it in GitHub Desktop.
from main.js it works fine... (?)
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