Last active
January 6, 2018 12:09
-
-
Save dominictarr/33042821928753986138942d0fdcefed to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$ node stream-heap.js | |
Readable 358.53592 134 | |
Writable 623.37824 258 | |
Transform 709.05584 1310 | |
$ node pull-heap.js | |
values 155.2692 70 | |
map 84.50328 7 | |
drain 203.86776 73 | |
$ node push-heap.js | |
Values 63.6348 31 | |
Map 103.9844 45 | |
Collect 112.44888 10 |
This file contains hidden or 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 pull = require('pull-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 | |
} | |
heap('values', pull.values) | |
heap('map', pull.map) | |
heap('drain', pull.drain) |
This file contains hidden or 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 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(new Stream()) | |
console.log(name, (process.memoryUsage().heapUsed - heap)/N, (Date.now()-start)) | |
a = null | |
} | |
heap('Values', require('push-stream--/values')) | |
heap('Map', require('push-stream--/async')) | |
heap('Collect', require('push-stream--/collect')) |
This file contains hidden or 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 streams = require('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(new Stream()) | |
console.log(name, (process.memoryUsage().heapUsed - heap)/N, (Date.now()-start)) | |
a = null | |
} | |
heap('Readable', streams.Readable) | |
heap('Writable', streams.Writable) | |
heap('Transform', streams.Transform) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
!!! creating 100k empty transform streams takes over a second !!!