Skip to content

Instantly share code, notes, and snippets.

// https://github.com/juliangruber/async-stream
function heap (name, Stream) {
var start = Date.now()
var heap = process.memoryUsage().heapUsed
var a = [], N = 100000
for(var i = 0; i < N; i++)
a.push(Stream())
console.log(name, (process.memoryUsage().heapUsed - heap)/N, (Date.now()-start))
a = null
@juliangruber
juliangruber / coros.js
Last active August 29, 2015 13:56 — forked from tj/coros.rb
function producer(){
return function*(){
return yield io.read();
};
}
function prepend(str, fn){
return function*(){
return str + yield fn();