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
// 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 |
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
function producer(){ | |
return function*(){ | |
return yield io.read(); | |
}; | |
} | |
function prepend(str, fn){ | |
return function*(){ | |
return str + yield fn(); |