Created
November 1, 2019 13:06
-
-
Save FbN/d8669ab01c1225f239eeafe3d4e2a28a 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
import { induce as mostInduce } from '../most.mjs' | |
import { induce as xstreamInduce } from '../xstream.mjs' | |
import { induce as rxjsInduce } from '../rxjs.mjs' | |
import { induce as imperativeInduce } from '../imperative.mjs' | |
import { typeWriter } from './common.mjs' | |
import memwatch from '@HolgerFrank/node-memwatch' | |
const type = process.argv[2] | |
const cycles = parseInt(process.argv[3]) | |
const induce = { | |
imperative: imperativeInduce, | |
most: mostInduce, | |
xstream: xstreamInduce, | |
rxjs: rxjsInduce | |
} | |
const writer = typeWriter('recursive-' + type) | |
let queue = Promise.resolve() | |
function cycle (induce, x) { | |
x > 0 && | |
induce({ | |
resolve: function () { | |
global.gc() | |
cycle(induce, x - 1) | |
} | |
}) | |
} | |
memwatch.on('stats', function (info) { | |
queue = queue.then(() => writer.writeRecords([info])) | |
}) | |
global.gc() | |
cycle(induce[type], cycles) | |
global.gc() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment